Page 1 of 1

Menu template not working with Navigator

Posted: Thu Nov 24, 2022 1:59 pm
by hdriezenlive
Hi,

I found out I have to switch from Menu manager to Navigator to be PHP8 compatible. However, when I change Menu into Navigator in my template, my menu no longer shows on the website. The menu-template is called correctly, but apparently is not processed.
My menutemplate looks like this:

Code: Select all

{strip}
{* CSS classes used in this template:
#menuwrapper - The id for the <div> that the menu is wrapped in. Sets the width, background etc. for the menu.
#primary-nav - The id for the <ul>
.menuparent - The class for each <li> that has children.
.menuactive - The class for each <li> that is active or is a parent (on any level) of a child that is active. *}

{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 class="menu">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string='<ul class="unli">' 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=
{elseif $node->type == 'sectionheader' and $node->haschildren == true}
  <li class="menuparent"><a class="menuparent" ><span class="sectionheader">{$node->menutext}</span></a>
{elseif $node->type == 'sectionheader'}
  <li><a ><span class="sectionheader">{$node->menutext}</span></a>
{elseif $node->type == 'separator'}
  <li style="list-style-type: none;"> <hr class="menu_separator" />
{elseif $node->children_exist == true and $node->depth < $number_of_levels and $node->type != 'sectionheader' and $node->type != 'separator'}
  <li class="menuparent"><a class="menuparent" href=
{else}
  <li>
  <a href=
{/if}

{if ($node->type != 'sectionheader' and $node->type != 'separator') or $node->parent == true or $node->current == true }
 {if $node->target}target="{$node->target}" {/if}
"{$node->url}"><span>{$node->menutext}</span></a>
{/if}
{/foreach}
{repeat string='</li></ul>' times=$node->depth-1}
</li>
<li><a id="xdisclaimer" href="javascript:doMenu('disclaimer');">Contact</a></li>

</ul>
{/if}
{/strip}
Any idea what can be wrong? I cannot find the cause of this problem myself.

Thanks!

Re: Menu template not working with Navigator

Posted: Thu Nov 24, 2022 3:27 pm
by DIGI3
MenuManager templates aren't directly transferrable to Navigator in most cases. Navigator was built to be recursive, it's more powerful and uses fewer resources, but that does mean different templates.

Have a look at the sample templates included with Navigator, then create a new one to use. In most cases you'll just need to change some of the class names to match the ones you were using in MM.

Re: Menu template not working with Navigator

Posted: Fri Nov 25, 2022 10:19 am
by hdriezenlive
Thank you for your quick reply.