Du bist nicht angemeldet. Der Zugriff auf einige Boards wurde daher deaktiviert.
Seiten: 1
#1 10. Februar 2014 11:21
- marc164
- probiert CMS/ms aus
- Ort: Alt Gaarz
- Registriert: 15. Dezember 2011
- Beiträge: 92
- Webseite
Zusätzliches Submenu in Sidebar einbinden, auf 2 level reduzieren
Guten Tag,
auf einer existierenden Seite möchte ich ein neues Template verwenden, aber das unterstützt nur 3 level submenus und ich habe schon 4. Die Seitenstruktur würde ich ungern ändern, wegen 404. Da es nur ein paar Seiten betrifft hatte ich angedacht, ein Menü einfach per Backend in die Sidebar zu setzen, hier als {menu template="menulevel3"}. Die Beschränkung auf die letzten 2 level funktioniert, aber das Menü wird doppelt ausgegeben. Ich habe jetzt schon eine ganze Weile rumprobiert und auch hier im Forum leider nix passendes finden können. Der code sieht folgendermaßen aus:
{menu start_level="3"}
{* CSS classes used in this template: .activeparent - The top level parent when a child is the active/current page li.active0n h3 - n is the depth/level of the node. To style the active page for each level separately. The active page is not clickable. .clearfix - Used for the unclickable h3 to use the entire width of the li, just like the anchors. See the Tools stylesheet in the default CMSMS installation. li.sectionheader h3 - To style section header li.separator - To style the ruler for the separator *}
{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}
<li class="currentpage"><h3>
<dfn>Current page is {$node->hierarchy}:
</dfn>{$node->menutext}</h3> {elseif $node->parent == true}
<li class="activeparent">
<a class="activeparent" href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}>
<dfn>{$node->hierarchy}:
</dfn>{$node->menutext}</a> {elseif $node->type == 'sectionheader'}
<li class="sectionheader">{$node->menutext} {elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;">
<hr /> {else}
<li>
<a 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 != ''} target="{$node->target}"{/if}>
<dfn>{$node->hierarchy}:
</dfn>{$node->menutext}</a> {/if} {/foreach} {repeat string="
</li>
</ul>" times=$node->depth-1}
</li>
</ul> {/if}
Vielen Dank!
Markus
Offline
#2 16. Februar 2014 23:04
- Andynium
- Moderator
- Ort: Dohna / SN / Deutschland
- Registriert: 13. September 2010
- Beiträge: 7.017
- Webseite
Re: Zusätzliches Submenu in Sidebar einbinden, auf 2 level reduzieren
aber das Menü wird doppelt ausgegeben.
Logisch ... du rufst es ja auch zwei mal auf
{menu start_level="3"}
{* CSS classes used in this template: .activeparent - The top level parent when a child is the active/current page li.active0n h3 - n is the depth/level of the node. To style the active page for each level separately. The active page is not clickable. .clearfix - Used for the unclickable h3 to use the entire width of the li, just like the anchors. See the Tools stylesheet in the default CMSMS installation. li.sectionheader h3 - To style section header li.separator - To style the ruler for the separator *}{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}
<li class="currentpage"><h3>
<dfn>Current page is {$node->hierarchy}:
</dfn>{$node->menutext}</h3> {elseif $node->parent == true}
<li class="activeparent">
<a class="activeparent" href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}>
<dfn>{$node->hierarchy}:
</dfn>{$node->menutext}</a> {elseif $node->type == 'sectionheader'}
<li class="sectionheader">{$node->menutext} {elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;">
<hr /> {else}
<li>
<a 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 != ''} target="{$node->target}"{/if}>
<dfn>{$node->hierarchy}:
</dfn>{$node->menutext}</a> {/if} {/foreach} {repeat string="
</li>
</ul>" times=$node->depth-1}
</li>
</ul> {/if}
Der markierte Code darf nur 1x aufgerufen werden, in Normalfall im Haupt-Template - du hast ihn aber scheinbar noch mal im Menü-Template drin.
Offline
#3 16. Februar 2014 20:05
- marc164
- probiert CMS/ms aus
- Ort: Alt Gaarz
- Registriert: 15. Dezember 2011
- Beiträge: 92
- Webseite
Re: Zusätzliches Submenu in Sidebar einbinden, auf 2 level reduzieren
Vielen Dank!
Offline
Seiten: 1