Page 1 of 1

displaying childrenof in submenu

Posted: Mon Sep 30, 2013 11:44 am
by KW2912
Sorry if this has already been answered elsewhere but I've looked through every post regarding "menu" and can't seem to solve my problem.

It's a simple task really. Trying to create a sub menu on my side nav reading from the main page. HTML for page template is:

Code: Select all

<!-- start menu -->
<div id="menu">
  <div class="inner-content">{menu}</div>
</div>
<!-- end menu -->

<!-- start content -->
<div id="content">

<div class="pflo-left">
<div id="pflo-menu">{menu childrenof='portfolio'}</div>
</div>

<div class="pflo-right">{content}</div>

</div>
<!-- end content -->
I'm using a custom menu template (basically just a copy of simple_navigation.tpl) and called it "main". I've selected it as my default so I can just the {menu} tag to call it. The menu template code is:

Code: Select all

{* 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 *} 

{assign var='number_of_levels' value=10000}
{if isset($menuparams.number_of_levels)}
  {assign var='number_of_levels' value=$menuparams.number_of_levels}
{/if}

{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->parent == true or $node->current == true}
  {assign var='classes' value='menuactive'}
  {if $node->parent == true}
    {assign var='classes' value='menuactive menuparent'}
  {/if}
  {if $node->children_exist == true and $node->depth < $number_of_levels}
    {assign var='classes' value=$classes|cat:' parent'}
  {/if}
  <li class="{$classes}"><a class="{$classes}" href="{$node->url}"><span>{$node->menutext}</span></a> |

{elseif $node->children_exist == true and $node->depth < $number_of_levels and $node->type != 'sectionheader' and $node->type != 'separator'}
<li class="parent"><a class="parent" href="{$node->url}"><span>{$node->menutext}</span></a>

{elseif $node->current == true}
<li class="currentpage"><h3><span>{$node->menutext}</span></h3>

{elseif $node->type == 'sectionheader'}
<li class="sectionheader"><span>{$node->menutext}</span>

{elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;"> <hr />

{else}
<li><a href="{$node->url}"><span>{$node->menutext}</span></a>

{/if}

{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
My problem is that the {menu} shows just fine on the top of my page but the sub menu doesn't show anything (it is main category item 3 and has 12 sub pages 3.1, 3.2 etc. I've tried:

{menu childrenof='portfolio'} (main category name)
{menu childrenof=$page_alias}
{menu start_level='2' collapse='1'}
{menu template='simple_navigation.tpl' number_of_levels='1'} with {menu template='simple_navigation.tpl' start_level='2' collapse='1'}

Both menu's are in different div classes for styling purposes but I'm guessing that shouldn't affect it?

Probably something really simple - can anybody spot anything glaringly obvious that I've missed?

Thanks for any help you can provide.

SOLVED Re: displaying childrenof in submenu

Posted: Mon Sep 30, 2013 12:52 pm
by KW2912
Yep I guessed - idiot on keyboard. It helps if you actually select the "show in menu" item for the sub pages. Doh!!!!

Re: displaying childrenof in submenu

Posted: Mon Sep 30, 2013 1:03 pm
by velden
I'd suggest to make a pre-installed menu template the default. Just to test it's not a mistake in your customizations.

{menu number_of_levels="1" start_level="2"} Should work.

Re: displaying childrenof in submenu

Posted: Mon Oct 14, 2013 9:24 pm
by fearmydesign
This thread was very helpful :) Thank you

Re: displaying childrenof in submenu

Posted: Tue Oct 15, 2013 8:10 am
by Rolf
Please don't forget to add [solved] to the title of the first post. Thanks.