Forums / Setup & design / Highlight itens in the menu

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

eZ debug

Timing: Jan 18 2025 16:26:52
Script start
Timing: Jan 18 2025 16:26:52
Module start 'content'
Timing: Jan 18 2025 16:26:52
Module end 'content'
Timing: Jan 18 2025 16:26:52
Script end

Main resources:

Total runtime0.1633 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 588.8438180.8359
Module start 'content' 0.00610.0054 769.679797.9922
Module end 'content' 0.01150.1517 867.6719525.8984
Script end 0.1631  1,393.5703 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00342.1013200.0002
Check MTime0.00140.8540200.0001
Mysql Total
Database connection0.00060.344810.0006
Mysqli_queries0.116771.50271410.0008
Looping result0.00150.88991390.0000
Template Total0.151492.710.1514
Template load0.00080.509610.0008
Template processing0.150592.199610.1505
Override
Cache load0.00060.377310.0006
Sytem overhead
Fetch class attribute can translate value0.00080.506610.0008
XML
Image XML parsing0.00030.182510.0003
General
dbfile0.00261.5650200.0001
String conversion0.00000.004230.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs