Forums / Setup & design / adding tree functionality to 3.4 subleft menu template

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

adding tree functionality to 3.4 subleft menu template

Author Message

steve walker

Thursday 17 June 2004 6:57:13 am

Hi there,

I want to create a 'TopLeft' nav system with subnavigation being listed down the left. The sub_left template does this, but doesnt expand to show further naviagtion, unlike the full flat_left template that has full tree menu functionality - and I want my sub_left template to behave as it is, but to exapnd treemenu styley!

I think the easiest solution is to hack the flat_left menu so that it starts at the subnav level, rather than at topnav level. The other alternative is to add treemenu functionality into the subleft template...

Could anyone give a pointer on doing this, my coding brain isnt that great...

Thanks, Steve.

http://www.oneworldmarket.co.uk

Mark Marsiglio

Thursday 17 June 2004 10:47:59 am

I think I have done what you are trying to do, but I am not sure. I have top level objects listed across the top of my site (in tabs). When you click on one of the tabs, the pages within that section appear in a left hand nav list with the section name at the top. If this is what you are trying to do I can post some code...

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

steve walker

Thursday 17 June 2004 12:02:30 pm

Mark,

It may be... I have top nav on top, and left hand sub nav working fine - but the left hand subnavigation doesnt expand out to show the third level navigation, and this is the bit I want to add.

If you have code that does this that would be marvellous!

Steve.

http://www.oneworldmarket.co.uk

Mark Marsiglio

Thursday 17 June 2004 12:36:47 pm

Try this...I have the depth set to 4 (four levels deep) but that is adjustable. In fact, that might be the only thing that I changed. This file is called flat_left.tpl and is located in mydesign/override/templates/menu folder.

Good luck...
Mark

<div id="leftmenu">
<div id="leftmenu-design">

<h3 class="hide">This menu {"Left menu"|i18n("design/base")}</h3>

<div id="navparent">
       {section name=parent loop=$module_result.path max=1 offset=1 }
             {section show=$parent:item.url}
                  <a href={$parent:item.url_alias|ezurl}>{$parent:item.text|wash}</a>
               {section-else}
    	      {$parent:item.text|wash}
               {/section}
    
         {/section}
</div>

{let docs=treemenu( $module_result.path,
                    $module_result.node_id,
                    array( 'folder', 'infopage', 'article' ), 1, 5 )
                    depth=4}
        <ul>
        {section var=menu loop=$:docs last-value}
            {section show=and( $menu.last.level|eq( $menu.level ), $menu.number|gt( 1 ) )}
                </li>
            {section-else}
            {section show=and( $menu.last.level|gt( $menu.level ), $menu.number|gt( 1 ) )}
                </li>
                    {"</ul>
                </li>"|repeat(sub( $menu.last.level, $menu.level ))}
            {/section}
            {/section}

            {section show=and( $menu.last.level|lt( $menu.level ), $menu.number|gt( 1 ) )}
                <ul>
                    <li class="menu-level-{$menu.level}">
            {section-else}
                <li class="menu-level-{$menu.level}">
            {/section}

            <a {$menu.is_selected|choose( '', 'class="selected"' )} href={$menu.url_alias|ezurl}>{$menu.text|shorten( 25 )}</a>

            {set depth=$menu.level}
        {/section}
           </li>

        {section show=sub( $depth, 0 )|gt( 0 ) loop=sub( $depth, 0 )}
            </ul>
        </li>
        {/section}
        </ul>

{/let}

</div>
</div>

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

steve walker

Friday 18 June 2004 3:03:15 am

Mark,

Many thanks - this code works perfectly!

Regards, Steve.

http://www.oneworldmarket.co.uk

Søren Knudsen

Tuesday 08 February 2005 8:23:01 am

How should i do if i only want to have the selected menu-item class="selected" in the menu, and not the whole path down to this item?

Best regards,
Søren Knudsen