Dynamic Header, CSS Class Change To Active USING PHP (dirrectory)
I want the class of the <li>
tag to change under the active dirrectory...
now, every guide shows me how to do it when your page equals it, but i want to change
the <li>
depending on what dirrectory im on
for example:
if say im on
http://example.com/RESOURCES/code/opensource,
or
http://example.com/RESOURCES/images/clipart
i want the "RESOURCES" ^^ <li>
to be 'class="active"' while the rest display 'class="noactive"'
or if im on
http://example.com/tutorials/css/flawless-dropdown-menu
I want the "tutorials" <li>
to be 'class="active"' while the rest are 'class="noactive"'
URL Setup:
This is my example of how my url's are displayed...
http://example.com/tutorials/css/flawless-dropdown-menu
^^That URL is the page of a tutorial....under the "tutorials" directory, than under the "CSS" category directory, than the page title (all of these directories are not real and are rewrites from .htaccess) [irrelevant]
Navigation Setup:
<ul id="mainnav">
<li class="noactive"><a href="/">Home</a></li>
<li class="active"><a href="/tutorials/">Tutorials</a></li>
<li class="noactive"><a href="/resources/">Resources</a></li>
<li class="noactive"><a href="/library/">Library</a></li>
<li class="noactive"><a href="/our-projects/">Our Projects</a></li>
<li class="noactive"><a href="/community/">Community</a></li>
</ul>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…