homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Nested Menus - How To?
How to generate a nested template using PHP?

 1:33 pm on Mar 25, 2007 (gmt 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)

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)

By nested I mean that the menu expands into several submenus.


 3:41 pm on Mar 29, 2007 (gmt 0)

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)

$_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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved