Left menu that start from the parent of current node

Author Message

Salvatore Guarino

Tuesday 30 August 2005 8:09:46 am

I would like to modify the following "left menu" template code. The goal is to set the root of the menu to the parent of the visited node. I.e.: i'm visiting the page of a product that's in the folder "Product", I'would like that the root of the left menu is "product". This is the code:

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

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

{let 	module_result.node_id
		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 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>

Thx,

Salvatore Guarino

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 31 2025 04:32:29
Script start
Timing: Jan 31 2025 04:32:29
Module start 'layout'
Timing: Jan 31 2025 04:32:29
Module start 'content'
Timing: Jan 31 2025 04:32:29
Module end 'content'
Timing: Jan 31 2025 04:32:29
Script end

Main resources:

Total runtime0.0148 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.3750151.2422
Module start 'layout' 0.00500.0034 739.617236.7109
Module start 'content' 0.00840.0045 776.328190.2188
Module end 'content' 0.01300.0018 866.546929.9922
Script end 0.0148  896.5391 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002818.7643140.0002
Check MTime0.00117.4244140.0001
Mysql Total
Database connection0.00064.294910.0006
Mysqli_queries0.002919.336530.0010
Looping result0.00000.088410.0000
Template Total0.00128.410.0012
Template load0.00096.175510.0009
Template processing0.00032.144210.0003
Override
Cache load0.00074.462010.0007
General
dbfile0.00031.932080.0000
String conversion0.00000.053040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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