dibeja wrote:Mhhh... maybe cheating up a bit the code..
Code: Select all
//------[FIND]-----------
if($thisactive) {
$css_list .= " id="".$class."_active"";
$activated = 1;
}
//----------[AFTER ADD]-------
if(next($top_struct) == false){
$css_list .= " class="".$class."_last"";
}
In this way, the last element of the list will have a class declaration:
In your example it will sound like this:
<div id="topnav">
<ul>
<li class="first"><a href="index.php?home"
class="current">Home</a></li>
<li><a href="index.php?contact_pks">Contact</a></li>
<li
class="topnav_last"><a href="#">Site Map</a></li>
</ul>
</div>
Check the HTML source code to see how the script generates classes and ids for the list element.
This added indeed that topnav_last class, but I still do not have the topnav_first.
I think it would be a good idea to always generate a "first" and "last" class, since these are the menu items that usually need to be styled differently.
Also, any ideas how could I get the first menu option active by default, without having to click on it?
Maybe have this as an 0/1 option meaning:
- 0: no menu option active by default, or
- 1: menu option 1 active by default, or
- 3: menu option 3 active by default
For instance when the users selects "About" on the horizontal menu:
- the "About" page is displayed
- the vertical menu is displayed on the "About" page
- the first option, say ""Company" in the vertical menu is active by default so that the articles under "Company" are shown without the user having to click on "Company"
What do you think? (I should learn PHP so that I can do these myself