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