Page 1 of 1

[SOLVED] Hide empty menu items : bug with children

Posted: Thu Aug 28, 2008 10:45 am
by Calculon
Hello,

I'm using the tip and trick #4 to hide empty menu items when the language is not ready yet.

But i have a bug when there are items with parent :

Default language version : no bug
Image

But with the english version there is a bug with next items (contact and Login) :

Image

Please note that the links who should be hidden are well hidden.

This the code of my menumanager template (with tip 4 code in it):

Code: Select all

{* CSS classes used in this template:
#menuwrapper - The id for the <div> that the menu is wrapped in. Sets the width, background etc. for the menu.
#primary-nav - The id for the <ul>
.menuparent - The class for each <li> that has children.
.menuactive - The class for each <li> that is active or is a parent (on any level) of a child that is active. *}
{if $count > 0}
<div id="menuwrapper">
<ul id="primary-nav">
{foreach from=$nodelist item=node}
{if !empty($node->menutext)}
{if $node->depth > $node->prevdepth}

	{repeat string="<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}

	{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
	</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
	<li class="menuactive menuparent"><a class="menuactive menuparent" 
{elseif $node->current == true}
	<li class="menuactive"><a class="menuactive" 
{elseif $node->haschildren == true}
	<li class="menuparent"><a class="menuparent" 
{elseif $node->type == 'sectionheader'}
        <li class="sectionheader"><span> {$node->menutext} </span>
{elseif $node->type == 'separator'}
        <li style="list-style-type: none;"> <hr class="separator" />
{else}
	<li><a 
{/if}
{if $node->type != 'sectionheader' and $node->type != 'separator'}
href="{$node->url}" {if $node->accesskey != ''}accesskey="{$node->accesskey}" {/if}{if $node->tabindex != ''}tabindex="{$node->tabindex}" {/if}{if $node->titleattribute != ''}title="{$node->titleattribute}"{/if}{if $node->target ne ""} target="{$node->target}"{/if}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>
{elseif $node->type == 'sectionheader'}
><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>
{/if}
{/if}
{/foreach}

	{repeat string="</li></ul>" times=$node->depth-1}		</li>
	</ul>
<div class="clearb"></div>
</div>
{/if}
Is anyone can help me with this please ? thx :)

Re: Hide empty menu items : bug with children

Posted: Thu Aug 28, 2008 10:54 am
by alby
Calculon wrote: I'm using the tip and trick #4 to hide empty menu items when the language is not ready yet.
Tips are examples only, depend from many factors

You must look in html source for check what is wrong and report after in your menu template

Post a link of your site, in this way other people can give you a hand

Alby

Re: Hide empty menu items : bug with children

Posted: Thu Aug 28, 2008 11:05 am
by Calculon

Re: Hide empty menu items : bug with children

Posted: Thu Aug 28, 2008 11:25 am
by alby
Calculon wrote: Here we go :)

http://dev.calculatrices-hp.com
because "Contact" and "Login" are external to: ul #primary-nav

Alby

Re: Hide empty menu items : bug with children

Posted: Thu Aug 28, 2008 12:26 pm
by Calculon
That's what i am seeing...

But I don't understand why  ??? : I'm using the same menu template (cssmenu_mle.tpl in my case) : it's just the default cssmenu.tpl including the tip #4 code.

There is a page using the original menu template : http://dev.calculatrices-hp.com/index.php?page=notation-polonaise-inversee&hl=en_US. As you can see, empty items in the "Where to buy" menu are not hidden (this is normal, the Tip#4 code is not included in that page).

But as soon as i'm including the code, empty items are hidden (that's cool), but following items in the menu are broken.

I tried to remove the tip #4 code from my cssmenu_mle.tpl, and thus the menu is no longer broken. (But empty items appear, which is quite logical).

So I think I did not properly inserted the code in the paper, Or, as you said, the code is not compatible in his state.

Re: Hide empty menu items : bug with children

Posted: Thu Aug 28, 2008 12:55 pm
by alby
Calculon wrote: That's what i am seeing...
It's broken because in FR you have 5.X.Y level and not in EN (5.X only)
loop add other that close

Alby

Re: Hide empty menu items : bug with children

Posted: Thu Aug 28, 2008 1:11 pm
by Calculon
Thank You ! :D

I filled the first 5.X.Y of my english menu, and it is no more broken.

By the way, is there a way to hidden parent items menu and childrens who are empty without broking the template ? (some kind of evolved Tip#4  ;) )

(In fact 5.2 and 5.2.Y shouldn't be filled in english, but 5.1 should)

Thanks again anyway.

Re: Hide empty menu items : bug with children

Posted: Thu Aug 28, 2008 1:38 pm
by alby
Calculon wrote: Thank You ! :D
Please, put [SOLVED] in title of first post

Calculon wrote: By the way, is there a way to hidden parent items menu and childrens who are empty without broking the template ? (some kind of evolved Tip#4  ;) )
Certainly yes but now I do not have the time to take a look  :(

Alby