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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 21:19:15
Script start
Timing: Jan 18 2025 21:19:15
Module start 'layout'
Timing: Jan 18 2025 21:19:15
Module start 'content'
Timing: Jan 18 2025 21:19:16
Module end 'content'
Timing: Jan 18 2025 21:19:16
Script end

Main resources:

Total runtime0.8753 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 588.1563152.6563
Module start 'layout' 0.00680.0024 740.812539.5078
Module start 'content' 0.00920.8648 780.3203608.2500
Module end 'content' 0.87400.0013 1,388.570316.1094
Script end 0.8753  1,404.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3576160.0002
Check MTime0.00130.1441160.0001
Mysql Total
Database connection0.00150.176910.0015
Mysqli_queries0.821393.8224680.0121
Looping result0.00070.0753660.0000
Template Total0.849697.120.4248
Template load0.00190.221220.0010
Template processing0.847696.834420.4238
Template load and register function0.00020.019410.0002
states
state_id_array0.00060.065610.0006
state_identifier_array0.00060.072120.0003
Override
Cache load0.00160.1868300.0001
Sytem overhead
Fetch class attribute can translate value0.00050.061530.0002
Fetch class attribute name0.00080.094170.0001
XML
Image XML parsing0.00060.072130.0002
class_abstraction
Instantiating content class attribute0.00000.001780.0000
General
dbfile0.00080.0896150.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs