Highlight itens in the menu

Author Message

Danilo Shiga

Wednesday 27 February 2008 12:00:44 pm

My problem is that when you choose any item of the flat_top menu this item become highlighted, but when some sub-item is chosen the menu loses it.

I wanted to be capable of keep the menu marked even when I'm in the sub-itens.

thanks for any help.

Mark Marsiglio

Wednesday 27 February 2008 12:29:14 pm

  {set $a_class = cond($current_node_in_path_3|eq($subitem.node_id), array("selected"), array())}

We have used this in combination with:

{if $a_class} class="{$a_class|implode(" ")}"{/if}

in the definition of the menu item <li> to achieve this effect. It depends on a few other variables being set (or changed to reflect your situation), but the result should be the class='selected' being applied to all of the items in the menu that are part of the current path.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Danilo Shiga

Wednesday 05 March 2008 11:43:28 am

Sorry, but I still don't get it...

I understood the code posted before, but I don't know how to set the variables to make this code work.

André R.

Wednesday 05 March 2008 1:06:23 pm

In ezwebin (and should also be in ezflow), there is two css classes you can use.
'current' is on menu element for the node you are currently on, and 'selected' is the on menu elements the is in the path you are in.

So you can have look in the code used there to see how it's done:
http://svn.ez.no/svn/extensions/ezwebin/trunk/packages/ezwebin_extension/ezextension/ezwebin/design/ezwebin/templates/menu/flat_top.tpl

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.