so on my site i have the index.php including nav.php file (for the navigation 🙂) and if the nav.php is run seperatly it works where when its included on the main site the static parts of the php is displayed but the dynamic parts are not.
Basically to cut things short its a script that scans a specified directory cuts out the . and .. and then snips off the .php extension on the files and then displays them in a web link, which forms a row in the nav table.
here is the code for nav.php:
<?
$dir = "../modules/";
echo "<table width='100%' border='1' align='center' cellpadding='1' cellspacing='0'>
<tr><td bordercolor='#000000' bgcolor='#FFFFFF'>Navigation</td></tr>";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ( $file != "." && $file != ".." ){
$file = basename ($file,".php");
echo "<tr><td><a href='../index.php?module=".$file."'>".$file."</a></td></tr>";
// echo "filename: $file : filetype: " . filetype($dir . $file) . "<br>";
}
}
closedir($dh);
}
}
echo "</table>";
?>
in index.php it just has:
include ("include/nav.php");