Forums / Setup & design / Strange behaviour! item.is_selected | choose

Strange behaviour! item.is_selected | choose

Author Message

Christof Bollenbeck

Wednesday 03 November 2004 6:56:05 am

Hi everybody.

I've posted this problem several weeks ago, but maybe it was not clear what I mean.

http://www.ez.no/community/forum/setup_design/treemenu_at_root_level_doesn_t_set_is_selected_attribute

In the template ivs_topnavigation.tpl, which is included in pagelayout.tpl, the following code brings up a menu:

<div id="navigation">
{let topMenu=treemenu($module_result.path,$module_result.node_id,array('folder'),0,0)}
 <ul>
  {section var=TopMenuItem loop=$topMenu}
   <li><a {$TopMenuItem.item.is_selected|choose('','class="selected"')} href= $TopMenuItem.item.url_alias|ezurl} title="{$TopMenuItem.item.text}">{$TopMenuItem.item.text}</a></li>
  {/section}
 </ul>
{/let}
</div>

The problem is, that the "selected"-class is not choosen as expected. Here comes the appropriate css-style:

#navigation li a:hover, #navigation li a.selected
{
	border-bottom: 5px solid #ffffff;
	background-color: #000000;
}

I don't have any idea about that behavior, because I use nearly the same code in another menu, which works great.

<div id="submenu">
<ul>
{let LeftMenu=treemenu($module_result.path,$module_result.node_id,array('login','article','folder','plain_html','Services'),1,1)}
    {section var=LeftMenuItem loop=$LeftMenu}
<li><a {$LeftMenuItem.item.is_selected|choose('','class="selected"')} href={$LeftMenuItem.item.url_alias|ezurl} title="{$LeftMenuItem.item.text}">{$LeftMenuItem.item.text}</a></li>
    {/section}
{/let}	
</ul>
</div>

And this is the appropriate css-style:

#submenu li a:hover, #submenu li a.selected
{
	border-left: 5px solid #800000;
	background-color: #CCCCCC;
	color: #404040;
}

One obvious difference is, that the LeftMenu is written directly in pagelayout.tpl and is not included via another template, but maybe I miss something very important... ;-)

Anyone understood my problem? Why does the is_selected attribute work in one, but not in the other template?

Many Greetings, Christof

eZ debug

Timing: Jan 18 2025 19:26:55
Script start
Timing: Jan 18 2025 19:26:55
Module start 'content'
Timing: Jan 18 2025 19:26:55
Module end 'content'
Timing: Jan 18 2025 19:26:55
Script end

Main resources:

Total runtime0.1688 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.0064 588.9609180.8125
Module start 'content' 0.00640.0071 769.773493.9453
Module end 'content' 0.01350.1552 863.7188524.3750
Script end 0.1688  1,388.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00372.2192200.0002
Check MTime0.00140.8491200.0001
Mysql Total
Database connection0.00090.509310.0009
Mysqli_queries0.123072.82171410.0009
Looping result0.00130.74571390.0000
Template Total0.154891.710.1548
Template load0.00090.536610.0009
Template processing0.153891.114110.1538
Override
Cache load0.00060.361210.0006
Sytem overhead
Fetch class attribute can translate value0.00100.574010.0010
XML
Image XML parsing0.00030.166910.0003
General
dbfile0.00171.0225200.0001
String conversion0.00000.004530.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