Version: 1.001
Type: Sample Code (HOWTO)
Category: HTML
License: GNU General Public License
Description: Use directories to make dynamic Navigation bars.
<table border=0>
<?php
#This is a very simple dynamic nav bar.
/*This is how to use. make a folder for every section of your site.
*the folder shold be named what the section is called.
* OR add a file .desc in the directory. the contents is what will be displayed
* as the link to that directory.
* copyright 2001 by James Stallings
* you can use this for anything, i don't care.
* PLEASE e-mail me if you like the code. and if you modify it. I'd like
* to know I'm helpful.
*/
/*what directory to use
* '.' is the directory that the page is in.
*/
$handle=opendir('.');
while (false !== ($file = readdir($handle)))
{
/*this will grap only directories*/
if (!strcmp(filetype($file), "dir"))
{
/* this is a list of directory not to list.
* seperate by space, and a space before and after.
* so 'bobsimages' does not exclude 'bob'
* a period at the begining will also exclude a directory.
* this shouldn't be hard to modified to have excluded directories in a file..
*/
if(stristr(" log apache icons cgi-bin .. . ", " ".$file." ") || substr($file, 0, 1) == ".")
continue;
/* what should the link text say?*/
$name = ucfirst($file);
if(file_exists($file.'/.desc'))
$name = implode('', file($file.'/.desc'));
/*pop the link out!*/
echo "<tr><td align=\"center\"><b><a class=\"nav\" href=\"".$file."\">-".$name."-</a></b></td></tr>";
}
}
?>
</table>