Results 1 to 4 of 4
Nov 3, 2011, 13:09 #1
- Join Date
- Mar 2006
- Calgary, Alberta, Canada
- 0 Post(s)
- 0 Thread(s)
Show current page and parents in multilevel navigation
I am currently building a site that is going to be 3 levels deep. What we want to do is to be able to highlight the current page that the user is on, as well as the parent and grandparent (section) of each link.
There is no CMS or database behind this site, and as such no way to really have no way to know what pages are actually related to which other ones.
To highlight the current page, I'd normally just do thos:
<li><a <?php if (strpos($_SERVER['PHP_SELF'], 'index.php')) echo 'class="current"';?> href="index.php">Home Page</a></li>
But I am trying to find the best way to find the parent and grandparent page. Am I best to just create 2 variables to target tthe higherarchy (sya $parent and $section), or would I be better to name all my pages as section1-sub1-page.php and use a function that checks the string of the filename for certain characters, and then creates the necessary variables? Or something else?