[solved] MenuManager {if $node->hierarchy > 2.8}

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
ofrost
Forum Members
Forum Members
Posts: 47
Joined: Tue May 01, 2007 8:52 pm

[solved] MenuManager {if $node->hierarchy > 2.8}

Post by ofrost »

Anyone knows why menumanager doesn't support this argument {if $node->hierarchy > 2.8} if items hierarchy higher than 2.9? It won't display menu items.
Last edited by ofrost on Fri Apr 30, 2010 4:55 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: MenuManager {if $node->hierarchy > 2.8}

Post by Dr.CSS »

What are you trying to do, much more info is needed to help you...

more info = more help...
ofrost
Forum Members
Forum Members
Posts: 47
Joined: Tue May 01, 2007 8:52 pm

Re: MenuManager {if $node->hierarchy > 2.8}

Post by ofrost »

Thanks for your reply.
My site structure looks like this.

1. About
2. Products
  2.1 Product 1
  2.2 Product 2
  2.3 Product 3
  2.4 Product 4
  2.5 Product 5
  2.6 Product 6
  2.7 Product 7
  2.8 Product 8
  2.9 Product 9
  2.10 Product 10
3. Service
4. Contacts

I want to create menu that shows products and their subpages, but I also want this menu to be divided into 4 columns (because some product pages have many subpages and menu gets big) and place it in the bottom of every page.

So for that I use 4 menu calls with limitation of how many product pages I want in one column. Thats where I use this construction {if $node->hierarchy > 2.8 and $node->hierarchy < 2.11 }. When I have 10 products and more this limitation won't work for products from 10 and above.

Maybe there is a better solution for this case. 
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: MenuManager {if $node->hierarchy > 2.8}

Post by Dr.CSS »

Looking in menu help it has only this... $node->hierarchy -- Hierarchy position, (e.g. 1.3.3)  which will show the hierarchy but I don't think it can be used for limiting the number of pages, maybe if you look at the Help you will find another way to do it...
ofrost
Forum Members
Forum Members
Posts: 47
Joined: Tue May 01, 2007 8:52 pm

Re: MenuManager {if $node->hierarchy > 2.8}

Post by ofrost »

It works fine with hierarchy on first level, but doesn't work when I try to limit pages on sublevel.

So far I can't find solution for this situation.
ofrost
Forum Members
Forum Members
Posts: 47
Joined: Tue May 01, 2007 8:52 pm

Re: [solved] MenuManager {if $node->hierarchy > 2.8}

Post by ofrost »

Here is menu tamplate that works

Code: Select all

{if $count > 0}
<div class="foot_nav">
<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->hierarchy|version_compare:'2.1':'>=' &&  $node->hierarchy|version_compare:'2.4':'<'}

  {if $node->parent == true or ($node->current == true and $node->haschildren == true)}
    <li><h2><a class="active" href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->current == true and $node->depth == '1'}
    <li><h2><a href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->haschildren == true}
    <li><h2><a class="menuparent" href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->type == 'sectionheader'}
    <li class="sectionheader"><span> {$node->menutext} </span>
  {elseif $node->type == 'separator'}
    <li class="seperator"> 
  {elseif $node->depth == '1'}
    <li><h2><a href="{$node->url}">{$node->menutext}</a></h2>
  {else}
    <li><a href="{$node->url}">{$node->menutext}</a>
  {/if}
{/if}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}
</li></ul></div>



<div class="foot_nav">
<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->hierarchy|version_compare:'2.4':'>=' &&  $node->hierarchy|version_compare:'2.7':'<'}

  {if $node->parent == true or ($node->current == true and $node->haschildren == true)}
    <li><h2><a class="active" href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->current == true and $node->depth == '1'}
    <li><h2><a href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->haschildren == true}
    <li><h2><a class="menuparent" href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->type == 'sectionheader'}
    <li class="sectionheader"><span> {$node->menutext} </span>
  {elseif $node->type == 'separator'}
    <li class="seperator"> 
  {elseif $node->depth == '1'}
    <li><h2><a href="{$node->url}">{$node->menutext}</a></h2>
  {else}
    <li><a href="{$node->url}">{$node->menutext}</a>
  {/if}
{/if}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}
</li></ul></div>


<div class="foot_nav">
<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->hierarchy|version_compare:'2.7':'>=' &&  $node->hierarchy|version_compare:'2.9':'<'}

  {if $node->parent == true or ($node->current == true and $node->haschildren == true)}
    <li><h2><a class="active" href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->current == true and $node->depth == '1'}
    <li><h2><a href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->haschildren == true}
    <li><h2><a class="menuparent" href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->type == 'sectionheader'}
    <li class="sectionheader"><span> {$node->menutext} </span>
  {elseif $node->type == 'separator'}
    <li class="seperator"> 
  {elseif $node->depth == '1'}
    <li><h2><a href="{$node->url}">{$node->menutext}</a></h2>
  {else}
    <li><a href="{$node->url}">{$node->menutext}</a>
  {/if}
{/if}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}
</li></ul></div>


<div class="foot_nav">
<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->hierarchy|version_compare:'2.9':'>=' &&  $node->hierarchy|version_compare:'2.11':'<'}
  {if $node->parent == true or ($node->current == true and $node->haschildren == true)}
    <li><h2><a class="active" href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->current == true and $node->depth == '1'}
    <li><h2><a href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->haschildren == true}
    <li><h2><a class="menuparent" href="{$node->url}">{$node->menutext}</a></h2>
  {elseif $node->type == 'sectionheader'}
    <li class="sectionheader"><span> {$node->menutext} </span>
  {elseif $node->type == 'separator'}
    <li class="seperator"> 
  {elseif $node->depth == '1'}
    <li><h2><a href="{$node->url}">{$node->menutext}</a></h2>
  {else}
    <li><a href="{$node->url}">{$node->menutext}</a>
  {/if}
  {assign var='temp_node_depth' value=$node->depth}
{/if}
{/foreach}
{repeat string="</li></ul>" times=$temp_node_depth-1}
</li></ul></div>
{/if}
And here is how it looks
http://new.vizitochka.com.ua/

Thanks to Peciura and mr101010
Last edited by ofrost on Fri Apr 30, 2010 7:29 pm, edited 1 time in total.
Peciura

Re: [solved] MenuManager {if $node->hierarchy > 2.8}

Post by Peciura »

Idea was to distribute menu branche 2 to 4 columns at the bottom of the page like this
 2.1 Product 1             2.4 Product 4             2.7 Product 7             2.9 Product 9
      2.1...                         2.4...                         2.7...                       2.9...
                                                                       ...
 2.2 Product 2             2.5 Product 5             2.8 Product 8             2.10 Product 10
       2.2...                        2.5...                         2.8...                          2.10...
 2.3 Product 3             2.6 Product 6
      2.3...                         2.6...
The reason for this - element 2.7 has many child nodes

Solution was to extract menu parts by page hierarchy. And this is one of 3 {if} statement that ofrost was missing

Code: Select all

{if $node->hierarchy|version_compare:'2.7':'>=' &&  $node->hierarchy|version_compare:'2.9':'<'}

{* if hierarchy is higher or equal to 2.7    AND   lower than 2.9  display menu as normaly*}

{/if}
ofrost also had an idea to add "Internal Page Links" to elements 2.X and arrange them the way he needed. He decided to do that other way to avoid possible issues with SEO. I do not think so, but battle is won, war is over and everybody are happy.
Last edited by Peciura on Fri Apr 30, 2010 8:04 pm, edited 1 time in total.
Post Reply

Return to “Modules/Add-Ons”