Forums / Setup & design / Changing the left menu behaviour

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