CMS Made Simple Forums
https://forum.cmsmadesimple.org/

Drop Down Menu
https://forum.cmsmadesimple.org/viewtopic.php?f=20&t=79303
Page 1 of 1

Author:  rob8271 [ Sat Oct 27, 2018 4:18 pm ]
Post subject:  Drop Down Menu

I am looking for a way to make our menu produce sub menus. The code for the menu is shown below and is a provided one in Menu Manager.


The code is:


{if $count > 0}
<div id="menuwrapper">
<ul id="primary-nav">
{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 and $node->haschildren == true)}
<li><a
{elseif $node->current == true}
<li><a
{elseif $node->haschildren == true}
<li><a
{elseif $node->type == 'sectionheader'}
<li><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}>{$node->menutext}</a>
{/if}
{/foreach}

{repeat string="</li>" times=$node->depth-1}</li>
</ul>
</div>
{/if}

Author:  Dr.CSS [ Sat Oct 27, 2018 11:21 pm ]
Post subject:  Re: Drop Down Menu

Do you haves pages with children..?

Does the menu tag in the tag in the template say number_of_levels='1'..?

Are you using a drop down menu stylesheet..?

More info = More help

Author:  rob8271 [ Sun Oct 28, 2018 9:29 am ]
Post subject:  Re: Drop Down Menu

Hi. Thanks for your reply. You will have to forgive me if I struggle a bit as I am a beginner at this.

Yes, I have pages with children.

If you mean this part of the template, there is no reference to levels at all.

<div id="menu">
<div class="menu_wrapper">
{menu template='Roundwood-menu' collapse='0'}
</div>

I think the stylsheet is what I am looking for, because the menu is only displaying as a single level menu.

Author:  velden [ Thu Nov 01, 2018 9:46 pm ]
Post subject:  Re: Drop Down Menu

What version of CMSMS are we talking about?

Author:  rob8271 [ Thu Nov 01, 2018 10:01 pm ]
Post subject:  Re: Drop Down Menu

it's 1.11.7 "Genovesa"

Author:  Gregor [ Fri Nov 02, 2018 6:52 am ]
Post subject:  Re: Drop Down Menu

Better first move to the latest version of cmsms; there is a difference in the approach on how to build a menu between the earlier and the later version of cmsms.

Author:  PinkElephant [ Fri Nov 02, 2018 11:07 am ]
Post subject:  Re: Drop Down Menu

As suggested, definitely upgrade if you can -- do it even if your can't ;). But if you're *really* stuck on 1.* ...

It's hard to believe that 1.11.7 shipped with the template you quoted. It's testing for sub-menu items, etc but doing nothing...

\$1:
   {if $node->parent == true or ($node->current == true and $node->haschildren == true)}
      <li><a
   {elseif $node->current == true}
      <li><a
   {elseif $node->haschildren == true}
      <li><a
   {elseif $node->type == 'sectionheader'}
      <li><span> {$node->menutext} </span>
   {elseif $node->type == 'separator'}
      <li style="list-style-type: none;"> <hr class="separator" />
   {else}
      <li><a
   {/if}


(I can't remeber 1.* too well but there might be an option to 'Reset' the template to factory-default).

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/