WebsiteBaker Support (2.8.x) > Templates, Menus & Design

Menu problem!

<< < (6/6)

Housy:
Hey, it's me again, if static way, how do i deal with the current/active link then? I have to check if page_id or something is equal to 1 for example and set the class="active" to home button.

This menus are killing me :|

Tnx, Housy

Argos:
I have done what you are looking for on maycroft.com. The main menu (the green bar) are static links, like so:

--- Code: ---<ul>
<li><a class="<?php if(PAGE_ID == 3 | ROOT_PARENT == 3) {echo &#39;activemenu&#39;;}?>" href="#">Risk Management</a></li>
<li><a class="<?php if(PAGE_ID == 4) {echo &#39;activemenu&#39;;}?>" href="#">Carbon Trading</a></li>
<li><a class="<?php if(PAGE_ID == 52 | ROOT_PARENT == 52) {echo &#39;activemenu&#39;;}?>" href="#">Education</a></li>
<li><a class="<?php if(PAGE_ID == 2) {echo &#39;activemenu&#39;;}?>" href="#">Exchanges and Clearing</a></li>
</ul>
--- End code ---
(I use # instead of real url's in this code example)
You see two menu items have the extra  bit
--- Code: ---| ROOT_PARENT ==
--- End code ---
to ensure that their children pages also cause the parent menu item to show the active status.

So you have to look up the page id's for each page, and create a css style for the actively selected status. Often that is the same as the hover style. So in my css file I have:


--- Code: ---#mainmenu li a:hover,
#mainmenu li a.activemenu {
background: url('../images/mainmenu-back2-hover.gif') left top repeat-x;
}
--- End code ---

Housy:
Thanks a lot Argos, it works really well :-D

Housy

Argos:

--- Quote from: Housy on July 28, 2009, 09:06:25 PM ---Thanks a lot Argos, it works really well :-D

--- End quote ---

Nice to know that it worked out well!  :wink:

Navigation

[0] Message Index

[*] Previous page

Go to full version