Welcome to WebmasterWorld Guest from 54.162.168.187

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Nested Menus - How To?

How to generate a nested template using PHP?

     
1:33 pm on Mar 25, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 17, 2004
posts:195
votes: 0


In each of my .php web pages I include("menu.php") which contains a menu of links to my web site pages.

How can I modify this simple model (without using a database) in order to create a nested template?

Do I have to create a different menu.php file for each group of second level pages? Or can I accomplish a two level menu with a single menu.php file (and still without using a database)?

4:31 pm on Mar 26, 2007 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12547
votes: 2


Could you clarify what you mean by the nested template? Is the menu not the same for all pages?
1:32 pm on Mar 29, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 17, 2004
posts: 195
votes: 0


By nested I mean that the menu expands into several submenus.
3:41 pm on Mar 29, 2007 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12547
votes: 2


You could do this a number of ways. My personal preference would be to keep it all in one file and use logic to display the expanded portions if necessary. Another option is to use pop-out submenus as opposed to expanded menus.
4:54 pm on Mar 29, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:June 25, 2002
posts:466
votes: 0


$_SERVER['PHP_SELF'] maybe the predefined variable that your looking for - it will give the filename (relative to the document root) of the page that the menu has been included on, you can then use that to determine which sub-menu(s) to display.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members