Having finally created my dynamic site generator, I'm now looking for a way to generate navigation by means of a script which does the following:
1. Looks for directories in and under a specified start directory
2. Grabs the filenames of the documents in them (which have been dynamically generated with the filename as the final name to display as a link, minus the .php extension)
3. Displays the name of the folder as a button or button-styled table cell
4. When the button is clicked, either a flyout or a breadcrumb system is revealed with the names of the pages as links
I found a nice script here: http://www.apptools.com/phptools/dynamicsitemap.php which is kind of what I'm after, but not quite.
Can anyone suggest a script resource or any known method without using MySQL (for reasons of immediate portability)??
I'm really looking for an example of something that's already been coded, so I can strip it down and learn how to construct this type of navigation myself.
Thanks in advance guys.
Generating dynamic navigation without MySQL
Moderator: General Moderators
- mattcooper
- Forum Contributor
- Posts: 210
- Joined: Thu Mar 17, 2005 5:51 am
- Location: London, UK
This is where it starts:
After that you where it says echo $file, add your links and what not...
Hope that helps you get started.
Code: Select all
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file\n";
}
}
closedir($handle);
}Hope that helps you get started.
There's also a function called is_dir to see if the handle is a directory or not.
http://us2.php.net/manual/en/function.is-dir.php
http://us2.php.net/manual/en/function.is-dir.php