I need to insert a class named "current" into a list like below depending on what page I am on.
All pages on my site are included into the index page like this,
Index.php includes a header file then it includes the body file and then footer file.
The body file will be one of the pages below.
It is included through the page like this in the url index.php?p=home
So I can easily get the page variable $p and know when I am on a certain page
Peki aşağıdaki gibi bir gezinti listeye "geçerli" css sınıfı eklemek için en iyi yolu olurdu?
<li class="drop"><a href=""><em>Home</em></a></li>
<li class="drop"><a href=""><em>inbox</em></a></li>
<li class="drop"><a href=""><em>outbox</em></a></li>
<li class="drop"><a href=""><em>online users</em></a></li>
<li class="drop"><a href=""><em>all users</em></a></li>
<li class="drop"><a href=""><em>forums</em></a></li>
<li class="drop"><a href=""><em>blogs</em></a></li>
<li class="drop"><a href=""><em>bulletins</em></a></li>
<li class="drop"><a href=""><em>news</em></a></li>
... Bu sadece bir mockup liste gerçek liste daha karmaşıktır
UPDATE: I don't know if an array is the way to go or not, Above is a quick example, below is my ACTUAL menu list, there are submenus embeded into the upper level list items, so if I am on any page in a submenu, the main menu should have the "current" class added to it, so doing an array is somewhat complex?
<div id="bottomrow">
<div class="pad">
<ul class="menu left">
<li class="first"><a href="/"><em>Home</em></a></li>
<li class="current users drop"><a href=""><em>Users</em></a><span class="drop"> </span>
<ul id="moreheader">
<li><a href=""><em>Widgets</em></a></li>
<li><a href=""><em>News</em></a></li>
<li><a href=""><em>Promote</em></a></li>
<li><a href=""><em>Development</em></a></li>
<li><a href=""><em>Bookmarks</em></a></li>
<li><a href=""><em>About</em></a></li>
</ul>
</li>
<li><a href=""><em>Forums</em></a></li>
<li class="drop current"><a href="/moreheader"><em>More</em></a><span class="drop"> </span>
<ul id="moreheader">
<li><a href=""><em>Widgets</em></a></li>
<li><a href=""><em>News</em></a></li>
<li><a href=""><em>Promote</em></a></li>
<li><a href=""><em>Development</em></a></li>
<li><a href=""><em>Bookmarks</em></a></li>
<li><a href=""><em>About</em></a></li>
</ul>
</li>
<li class="moneytabmenu"><a href="/moneytabmenu"><em>Money:<span class="moneytabmenu-total">$0.00</span></em></a></li>
</ul>
<ul class="menu right">
<li class="drop myaccount"><a href="" class="first"><img class="avatar" src="http://gravatar.com/avatar.php?gravatar_id=7ab1baf18a91ab4055923c5fd01d68a2&rating=pg&size=80&default=" height="19" width="19" alt="you" /><em>My
Account</em></a><span class="drop"> </span>
<ul id="myaccount">
<li><a href=""><em>Dashboard</em></a></li>
<li><a href=""><em>Account Settings</em></a></li>
<li><a href=""><em>Settings</em></a></li>
</ul>
</li>
<li class="drop"><a href=""><em>Mail</em></a><span class="drop"> </span>
<ul id="mailboxheader">
<li><a href=""><em>InBox</em></a></li>
<li><a href=""><em>SentBox</em></a></li>
<li><a href=""><em>Trash</em></a></li>
<li><a href=""><em>Post Bulletin</em></a></li>
<li><a href=""><em>View Bulletins</em></a></li>
</ul>
</li>
<li class="drop"><a href=""><em>More</em></a><span class="drop"> </span>
<ul id="moreheader">
<li><a href=""><em>Widgets</em></a></li>
<li><a href=""><em>News</em></a></li>
<li><a href=""><em>Promote</em></a></li>
<li><a href=""><em>Development</em></a></li>
<li><a href=""><em>Bookmarks</em></a></li>
<li><a href=""><em>About</em></a></li>
</ul>
</li>
</ul>
</div>
</div>
<!-- END div#bottomrow -->
</div>