Setting Left menu (treemenu) to another nodeId

Author Message

Alexander Petrov

Wednesday 06 December 2006 7:12:08 am

Hi!

I'm trying to set the left treemenu to another nodeId.
Here is the template code:

{let docs=treemenu( $module_result.path,
                    is_set( $module_result.node_id )|choose( 2, $module_result.node_id ),
                    ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
                    0, 5 )
                    depth=1
                    last_level=0}
        <ul>
        {section var=menu loop=$:docs last-value}
            {set last_level=$menu.last|is_array|choose( $menu.level, $menu.last.level )}
            {section show=and( $last_level|eq( $menu.level ), $menu.number|gt( 1 ) )}
                </li>
            {section-else}
            {section show=and( $last_level|gt( $menu.level ), $menu.number|gt( 1 ) )}
                </li>
                    {"</ul>
                </li>"|repeat(sub( $last_level, $menu.level ))}
            {/section}
            {/section}

            {section show=and( $last_level|lt( $menu.level ), $menu.number|gt( 1 ) )}
                {'<ul><li>'|repeat(sub($menu.level,$last_level,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}><span class="arrowz">&gt;&gt;</span>&nbsp;  {$menu.text|shorten( 25 )}  &nbsp; </a>

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

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

{/let}

I cannot understand what parameter should be changed for this.
I'v changed from 2 to another nodeid here

is_set( $module_result.node_id )|choose( 2, $module_result.node_id ),

but nothing happened. Menu.ini parameters are not documented yet :(

Can anyone help?

Jon Staines

Friday 08 December 2006 8:02:35 am

The menu.ini setting being used in this template is just set to limit which classes will be included in the menu. The line:

ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' )

means look in menu.ini (and any of the menu.ini overrides or siteaccess files), find the section starting with MenuContentSettings, and look at the value of LeftIdentifierList. So in the menu.ini.append.php for that siteaccess you will find a section called MenuContentSettings similar to:

[MenuContentSettings]
TopIdentifierList[]
TopIdentifierList[]=folder
LeftIdentifierList[]=feedback_form
LeftIdentifierList[]
LeftIdentifierList[]=folder
LeftIdentifierList[]=news_folder

Which would mean that only nodes which were of the class folder or news_folder would appear in the left menu.

I think the

is_set( $module_result.node_id )|choose( 2, $module_result.node_id )

provides some kind of fallback mechanism so that it uses the root node 2 if the module_result is empty. Hopefully somebody else can provide a better explanation for how it works. Its ugly but you could always hard code the node id you want the tree to start at:

{let docs=treemenu( $module_result.path,
                    xxxxx,
                    ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
                    0, 5 )
                    depth=1
                    last_level=0}

Where xxxxx is the node id that is the top of the tree.

Olav Bringedal

Thursday 21 December 2006 2:11:04 am

node_id is deprecated from treemenu for newer versions, so changing $module_result.path is the way to go


Senior Consultant
http://Umoe-consulting.no

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 16:04:51
Script start
Timing: Jan 18 2025 16:04:51
Module start 'layout'
Timing: Jan 18 2025 16:04:51
Module start 'content'
Timing: Jan 18 2025 16:04:51
Module end 'content'
Timing: Jan 18 2025 16:04:51
Script end

Main resources:

Total runtime0.7260 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0079 588.0469152.6406
Module start 'layout' 0.00800.0025 740.687539.4766
Module start 'content' 0.01050.7143 780.1641587.4844
Module end 'content' 0.72480.0012 1,367.648412.1250
Script end 0.7260  1,379.7734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4611160.0002
Check MTime0.00140.1906160.0001
Mysql Total
Database connection0.00190.255110.0019
Mysqli_queries0.673292.7251590.0114
Looping result0.00060.0778570.0000
Template Total0.694595.720.3472
Template load0.00200.269220.0010
Template processing0.692595.385720.3463
Template load and register function0.00010.019810.0001
states
state_id_array0.00080.109910.0008
state_identifier_array0.00170.231020.0008
Override
Cache load0.00160.2248270.0001
Sytem overhead
Fetch class attribute can translate value0.00070.100330.0002
Fetch class attribute name0.00100.143050.0002
XML
Image XML parsing0.00100.135430.0003
class_abstraction
Instantiating content class attribute0.00000.001450.0000
General
dbfile0.00080.1088220.0000
String conversion0.00000.001140.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs