Forums / Setup & design / Setting Left menu (treemenu) to another nodeId

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

eZ debug

Timing: Jan 18 2025 11:44:52
Script start
Timing: Jan 18 2025 11:44:52
Module start 'content'
Timing: Jan 18 2025 11:44:52
Module end 'content'
Timing: Jan 18 2025 11:44:52
Script end

Main resources:

Total runtime0.2097 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0091 589.2734180.8125
Module start 'content' 0.00910.0121 770.085998.0547
Module end 'content' 0.02120.1884 868.1406528.3750
Script end 0.2096  1,396.5156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00522.4758200.0003
Check MTime0.00190.8981200.0001
Mysql Total
Database connection0.00120.569510.0012
Mysqli_queries0.150871.92221410.0011
Looping result0.00140.64821390.0000
Template Total0.187689.510.1876
Template load0.00180.837510.0018
Template processing0.185988.658010.1859
Override
Cache load0.00090.448410.0009
Sytem overhead
Fetch class attribute can translate value0.00110.512710.0011
XML
Image XML parsing0.00030.131110.0003
General
dbfile0.00180.8747200.0001
String conversion0.00000.003830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs