Page 1 of 1
[solved] custom menu with <p> inside?
Posted: Mon Aug 20, 2007 3:14 pm
by firfelin
Hi,
I would like to have some kind of custom menu, with a descriptive text after the main menus and before the sub-category, something like:
Code: Select all
MENU 1.1
<p>
blablabla
etc
...
</p>
SUBMENU 1.1.1
SUBMENU 1.1.2
SUBMENU 1.1.3
MENU 1.2
<p>
blablabla
etc
...
</p>
SUBMENU 1.2.1
SUBMENU 1.2.2
SUBMENU 1.2.3
I dont understand menu template well enough to build something like: if hierarchy=1.1 put this text after li, if hierarchy=1.2 put this another text after li etc...
Is it possible?
Thanks a lot in advance for any help
Re: custom menu with <p> inside?
Posted: Mon Aug 20, 2007 5:10 pm
by cyberman
Re: custom menu with <p> inside?
Posted: Mon Aug 20, 2007 7:30 pm
by firfelin
thanks a lot for the tips
After some newb' ¿?@†aaaargh with the syntax, I've finally obtained what I wanted:
"my_menu":
Code: Select all
{if $count > 0}
<ul>
{foreach from=$nodelist item=node}
{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->depth == 1}
<li><a href="{$node->url}" {if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}</a><p>{$node->titleattribute}</p>
{elseif $node->current == true}
<li><a href="{$node->url}" class="currentpage"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}</a>
{else}
<li><a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}</a>
{/if}
{/foreach}
and then i call it 3 times (I have some kind of "special" design...) in the page template with
Code: Select all
{menu template="my_menu" start_element="1.2"}
{menu template="my_menu" start_element="1.3"}
{menu template="my_menu" start_element="1.4"}
Re: [solved] custom menu with <p> inside?
Posted: Tue Aug 21, 2007 6:00 am
by cyberman
Every call of menumanager eats a lot of performance and you call it three times

.
Change your template like this
{if $count > 0}
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="" times=$node->depth-$node->prevdepth}
{elseif $node->depth prevdepth}
{repeat string="" times=$node->prevdepth-$node->depth}
{elseif $node->index > 0}
{/if}
{if $node->depth == 1}
url}" {if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}{if $node->titleattribute ne ""}{$node->titleattribute}{/if}
{elseif $node->current == true}
url}" class="currentpage"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{else}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{/if}
{/foreach}
After that you need only one menu call if you add only content in title attribute for level 1.1, 1.2 and so other

.
Re: [solved] custom menu with <p> inside?
Posted: Tue Aug 21, 2007 8:27 am
by firfelin
...mmh
I think I dont have the choice... I have to call it three times, because the menu is actually in three different separated parts.
Re: [solved] custom menu with <p> inside?
Posted: Tue Aug 21, 2007 9:30 am
by cyberman
Can you post a link?
Re: [solved] custom menu with <p> inside?
Posted: Tue Aug 21, 2007 10:22 am
by firfelin
I have sended it by PM
Re: [solved] custom menu with <p> inside?
Posted: Tue Aug 21, 2007 1:10 pm
by cyberman
Got it.
It's only a question of CSS. Normally every is a block element which means a line break.
But if you set for the second level to an inline element it should be possible to get three columns

.
Re: [solved] custom menu with <p> inside?
Posted: Tue Aug 21, 2007 2:08 pm
by firfelin
I'll try; thanks a lot for your help and advices
