[gelöst] MenüManager unterschiedl. IDs

Hilfe zu Modulen und Tags
Post Reply
nicmare
Power Poster
Power Poster
Posts: 1150
Joined: Sat Aug 25, 2007 9:55 am

[gelöst] MenüManager unterschiedl. IDs

Post by nicmare »

Ich hab folgendes Script für mein Menü:

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->current == true || $node->parent == true}
			<li class="selected"><a href="{$node->url}">{$node->menutext}</a>

{else}
			<li><a href="{$node->url}">{$node->menutext}</a>{/if}{/foreach}{repeat string="</li></ul>" times=$node->depth-1}</li>
			</ul>
{/if}
Nun möchte ich aber dass jedes Listenelement zusätzlich noch eine id bekommt. Und zwar eine eindeutig - so wie es sich gehört ;-).
Also möchte ich irgendwie da nen Zähler integrieren der dann jedem Menüpunkt ne Idee mit so einer Syntax verpasst: id="button1" ... id="button6" usw.
Wie stelle ich das am besten an?
Grüße
Last edited by nicmare on Thu Jul 17, 2008 11:42 am, edited 1 time in total.
cyberman

Re: MenüManager unterschiedl. IDs

Post by cyberman »

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->current == true || $node->parent == true}
			<li id="button{$node->hierarchy}" class="selected"><a href="{$node->url}">{$node->menutext}</a>

{else}
			<li id="button{$node->hierarchy}"><a href="{$node->url}">{$node->menutext}</a>{/if}{/foreach}{repeat string="</li></ul>" times=$node->depth-1}</li>
			</ul>
{/if}
Last edited by cyberman on Thu Jul 17, 2008 10:54 am, edited 1 time in total.
NaN

Re: MenüManager unterschiedl. IDs

Post by NaN »

Oder $node->index  ;)

{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->current == true || $node->parent == true}
url}" id="button_{$node->index}">{$node->menutext}

{else}
url}" id="button_{$node->index}">{$node->menutext}{/if}{/foreach}{repeat string="" times=$node->depth-1}

{/if}
nicmare
Power Poster
Power Poster
Posts: 1150
Joined: Sat Aug 25, 2007 9:55 am

Re: MenüManager unterschiedl. IDs

Post by nicmare »

hmm. manchmal sind die sachen einfach als man annehmen würde :).
großen dank an euch beide
Post Reply

Return to “Module und Tags”