Changing the left menu behaviour

Author Message

Lydie Soler

Tuesday 02 August 2005 8:28:29 am

Hi,

I have added the left menu to my site. Works well!
It displays all the folders I have.
I would like to change it in order to have on this left menu only the subfolders corresponding to the folder where I am

What do I have to change.....
THansk a lot

Luc Chase

Tuesday 02 August 2005 12:17:35 pm

Assuming you also have the top-menu...
Incrementing the offset value by 1 should do it...
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/modules/content/fetch_functions/tree

The Web Application Service Provider

Lydie Soler

Wednesday 03 August 2005 4:52:34 am

yes your right. But it looses the first top folder...
let me be more precise:
- top folder
- sub folder 1
- sub sub folder 1
- sub folder 2
...

with your solution I don't have top folder...
How can I keep it ?

Lydie Soler

Wednesday 10 August 2005 5:42:54 am

Here is the solution....

Your create a section for each top folder then you use this code replacing part of the old one:


 {section var=menu loop=$:docs last-value}

              {let monnoeud=fetch( 'content', 'node', hash( 'node_id', $menu.id ) )}
{if eq($monnoeud.object.section_id,$module_result.section_id)}


            {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}
{/if}
{/let}
        {/section}

What is important is this

 {let monnoeud=fetch( 'content', 'node', hash( 'node_id', $menu.id ) )} 

to get the full information of the node and then

{if eq($monnoeud.object.section_id,$module_result.section_id)} 

to exclude the object that doesn't belong to the same section as the module_result

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 19 2025 00:25:45
Script start
Timing: Jan 19 2025 00:25:45
Module start 'layout'
Timing: Jan 19 2025 00:25:45
Module start 'content'
Timing: Jan 19 2025 00:25:46
Module end 'content'
Timing: Jan 19 2025 00:25:46
Script end

Main resources:

Total runtime0.6877 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 587.9375152.6250
Module start 'layout' 0.00630.0032 740.562539.4453
Module start 'content' 0.00950.6766 780.0078514.8984
Module end 'content' 0.68610.0015 1,294.906312.1563
Script end 0.6876  1,307.0625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4469160.0002
Check MTime0.00130.1944160.0001
Mysql Total
Database connection0.00090.136310.0009
Mysqli_queries0.634892.3138600.0106
Looping result0.00070.1073580.0000
Template Total0.657095.520.3285
Template load0.00200.288220.0010
Template processing0.655095.252720.3275
Template load and register function0.00020.027010.0002
states
state_id_array0.00110.158610.0011
state_identifier_array0.00080.118420.0004
Override
Cache load0.00170.2402320.0001
Sytem overhead
Fetch class attribute can translate value0.00080.110220.0004
Fetch class attribute name0.00130.189840.0003
XML
Image XML parsing0.00020.032720.0001
class_abstraction
Instantiating content class attribute0.00000.001740.0000
General
dbfile0.00200.2968100.0002
String conversion0.00000.001240.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
4content/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
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/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: 24
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs