Click to See Complete Forum and Search --> : can PHP do this? dynamic menu.


Rookie
04-01-2005, 10:29 PM
I am wanting to build a menu navigation system for my site. The concept goes as follows:

The menu will be in a frame on the left side of my page.
All links will load the target in the right side of my page.

The links on the menu will be dynamically generated using the folder structure of the site.

**********
It would work something like this.
When you create a folder named “foo” off the root of my site then when I refreshed my menu a new link would appear http://mysite.com/foo/ this link would load a default page. say index.html or default.htm.

In each folder there would be a txt file that would have 2 pieces of information.
1) The link text.
2) The menu order number.

The menu script would traverse the directory structure of the site and read in the above mentioned text files. If the file is not found it doesn’t create a link for the directory.

All links/directories that have the same menu order number (ie 2 directories with level #3 in the text file) need to be displayed in alpha sort order using the link text.

It would only need to look for subdirectories that exist in the root directory of the site. It doesn’t need to go down the tree any further than that.

Need a method of displaying the links so that they appear to be buttons of some sort so the hit box area is larger than a standard url link. (also make it look a little better)
***********

let me close this post by saying I have a linux development environment with a tested PHP enabled apache server. I have 2 sites setup one for development and one for testing.

I have never written a single line of PHP code but I am an application developer so I think I can pick it up pretty quick.

Having said all this the question is: Can this be done with PHP, or is there a better alternative?

Thanks for spending the time to read this very long post.

phpnovice
04-02-2005, 11:02 AM
Yes, that would be no problem for PHP.

96turnerri
04-02-2005, 12:31 PM
i agree that is a relativly easy for PHP to achieve

Rookie
04-02-2005, 02:04 PM
good news,

do you know of any similar scripts that i could use as a starting place?
i see 2 major parts, reading the directories and locating/ eading the text files in those directories.
i have been looking around and haven't run across any example scripts of how to do this.

solomon
04-02-2005, 02:26 PM
good news,

do you know of any similar scripts that i could use as a starting place?
i see 2 major parts, reading the directories and locating/ eading the text files in those directories.
i have been looking around and haven't run across any example scripts of how to do this.

You should find good examples of what you need on www.php.net. For example on this page (http://uk.php.net/manual/en/function.opendir.php)

Rookie
04-02-2005, 02:57 PM
I will check it out.

thanks.

jfaust97
06-30-2006, 09:26 AM
This may help....

http://www.aheadofmytime.com/hitbox_php_javascript_dynamic_page_name.php