Set active links by current URL for Open-Realty®
The result printed at your browser will be simply:
("###" will be the value grabbed from the URL)
The above DEMO have this HTML code:
<ul> <li class="curr_index"><a href="./">LINK 01</a></li> <li class="curr_2"><a href="index.php?action=page_display&PageID=2#test">LINK 02</a></li> <li class="curr_searchresults"><a href="index.php?action=searchresults">LINK 03</a></li> <li class="curr_searchpage"><a href="search.html">LINK 04</a></li> </ul>
Notice "LINK 01" have no "action" or "PageID" set. Notice "LINK 02" have an action set as "page_display" but also has a "PageID" (and a "hash"). Notice "LINK 03" have only an action set. Notice "LINK 04" have a SEF link.
The CSS code... can be whatever you wish.
For better understanding, for example:
- "LINK 02" have a class name "curr_2"... the integer "2" will only be grabbed from the URL if the current page is "index.php?action=page_display&PageID=2"
- "LINK 03" have a class name "curr_searchresults"... the value "searchresults" will only be grabbed from the URL if the current page is "index.php?action=searchresults"
Of course, my code can be customized for different results and for different softwares.
It was tested with Open-Realty v.3.2.4 and ALL major browsers IE6/7/8/9, Firefox, Chrome and Safari.
I hope it will be useful for you! Please keep my copyright message (at the example for download above).
Enjoy it! :)
Eduardo Marques (a.k.a. "ebmarques")