Elxis CMS Forum
Extensions => Templates => Topic started by: LT-user on March 23, 2008, 11:54:51
-
How to set the current state for menu ? I want the link in the menu for the current page to appear differently e.g. bold.
Anyone a solution?
-
From your css.
What template are you use?
-
I creating my own template. 8) and I want to set current menu items. I will try...something ;D
-
Use:
a#active_menu or
.mainlevel#active_menu or
a.mainlevel#active_menu
in your .css file of template
-
Thanx it's working... ;) but...
Now, when I click a menu item a page appears with a second menu. I want the item in the first menu to stay active and the first item in the second menu should also be active. ::)
-
Can you give us a link? I can't really understand what you want to do... :P
-
I have a main menu button which has 2 sub menu buttons. Everything I want to do is the main menu schould stay active if the sub menu-item is activated.
Home
About us ( active mainmenu item)
|____About Us Item 1
|____About Us Item 2 (active submenu item)
Another Menu
Etc.
When a user selects one of these submenu items, I want the active submenu AND mainmenu items to be hilighted using active_menu
thanks for the help ;)
-
Active menu item is an item that currently clicked on it and the related content is displayed ...
So you can have one activated menu item in the same time ... Not 2 menu item ...
-
Farhad was faster... :)
The whole active menu item system is made to help user understand better where he is. And as Farhad said, you cannot be at two places at once....
However, if you, for some reason insist on this, you can find a solution trough css.
-
As i know activation of a menu item , uses a code in file : /modules/mod_mainmenu.php
//Active Menu highlighting
$current_itemid = $Itemid;
if ( !$current_itemid ) {
$id = '';
} else if ( $current_itemid == $mitem->id ) {
$id = ' id="active_menu'.$params->get( 'class_sfx' ).'"';
} else {
$id = '';
}
The code adds an id with name : active_menu to current menu item , so if we click on a menu item on a menu , the code assigns this id to A tag of menu item dynamically , like this :
<a href="index.php?option=com_content&task=section&id=4&Itemid=16" title="Discover Elxis" class="mainlevel" id="active_menu">Discover Elxis</a>
The id="active_menu" property shows us that this menu item is our active menu item , this help us that we can style it through a css style ...
And other menu items remains without any id , like this :
<a href="index.php?option=com_content&task=view&id=31&Itemid=26" title="The Elxis license" class="mainlevel">The Elxis license</a>
You can review codes of /modules/mod_mainmenu.php file and write some hack for it if you want , for example adding another id or same id to parent menu item , and finally assign a css class for that id in your template css file ... :)