|
Nov 12
2009
|
Finding the top menuPosted by Bill Tomczak in templates , php coding , joomla 1.5 |
I was recently asked if there was a way to get the topmost menu item in which a page sits. Let's say you have a menu like this:
Item 1
--Item 1.1
--Item 1.2
----Item 1.2.1
Item 2
--Item 2.1
--Item 2.2
Let's say you wanted to do something special with all the menus in the 'Item 1' tree and something slightly different for all the items in the 'Item 2' tree. You'd want to know which tree you were on. Here is a bit of simple php code you can use the get the top most menu item no matter where in the navigation you are (see php 4 version further down):

Joomla!
Subscribe to this site's RSS feed
Tweet