I see this code is riddled with errers I hadn't anticipated. It was given to me by one of my professors as an example on how PHP works. Because this script is designed to handle a current need, I decided to dust it off an attempt to use it.
I appreciate you patience with me. I correct all of the print syntax. However, I am now getting the following error:
Parse error: parse error, unexpected $ in /home/hearnofg/public_html/temp/sermons/index.php on line 52
The only thing at line 52 is the closing tag: ?>
<?php
//include header information
include("header.inc");
[B]
print("<table width='100%' border='0'><tr>");[/B]
//the following cell display the list of links
[B]print("<td valign='top'>Choose your article:<br /><ul>");[/B]
//Open current directory
if ($handle = opendir(".")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "header.inc" && $file != "footer.inc" && $file != "index.php") {
//replace each underscore ("_") with a blank space
$name = ereg_replace("_", " ", $file);
//strip off the .inc from the file name
$name = ereg_replace(".inc", "", $name);
//strip off the .inc from the file
$file= ereg_replace(".inc", "", $file);
//print link and name
[B] print("<li><a href =\"template.php?topic=$file\">$name</a></li>");[/B]
}
endfile;
//close the directory
closedir($dir_handle);
[B]print("</ul></td>");
[/B]
// the following cell includes the requested content files
[B]print("<td valign='top'>");[/B]
//if no topic selected, display the default content
if($topic == ""){
[B]print("Welcome to our article archive");[/B]
//else the user clicked on a link, so include content related to that link
} else {
include ("$topic.inc");
}
[B]print("</td></tr></table>");[/B]
//incude footer info
include ("footer.inc");
?>