Left menu, exclude a node

Author Message

Sunday 20 February 2005 5:55:42 am

I'm trying to exclude one node (folder 142) or more nodes from the flat_left.tpl template without any success. I've read several post about how to accomplish this without any luck.

This is the original code for the template.

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

            {section show=and( $menu.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}

Suggestions to make this code work as mentioned above is highly appreciated.
I'm using eZ Publish version 3.5

Arran Price

Sunday 20 February 2005 1:17:07 pm

Shouldnt you be able to put a

{section show=currentnode|ne('142')}
{/section}

where currentnode is whatever holds the node value
around the entire contents of the loop ie:

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

so put the section show the line after the loop statement and close the section statement one line above the close for the loop.

Hope thats of some help

Arran

Sunday 20 February 2005 3:36:29 pm

Thanks for the reply.

I guess this is how you tried to explain the code should be:

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

            {section show=and( $menu.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}
        {/section}
           </li>

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

{/let}

This doesn't help, node 142 is still show in the left menu.

Arran Price

Sunday 20 February 2005 4:17:25 pm

you need to replace "currentnode" with the correct variable.
It might be something along the lines of
$module_result.path[1].node_id (which I dont think will work).

The way to go to figure out what the correct variable is, would to be use attribute show etc

{$our_variable|attribute(show,1)}

throw your vars like last-value etc in there and you should see what you need.

Sorry cant be of more help. Am just too busy at the moment.

Arran

Friday 25 February 2005 4:51:04 am

This is how I filtered away node id 142.
I'm not sure if this is the recommended way of doing it, but it works.

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

            {section show=and( $menu.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}
        {/section}
        </ul>

{/let}

Friday 25 February 2005 6:34:12 am

This code works the way I wanted it to.

Note
{/section} was placed in the wrong place in my previous code listing.

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

            {section show=and( $menu.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}
        {/section}
           </li>

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

{/let}

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 03:33:17
Script start
Timing: Jan 31 2025 03:33:17
Module start 'layout'
Timing: Jan 31 2025 03:33:17
Module start 'content'
Timing: Jan 31 2025 03:33:17
Module end 'content'
Timing: Jan 31 2025 03:33:17
Script end

Main resources:

Total runtime0.0227 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.1328151.2109
Module start 'layout' 0.00510.0033 739.3438220.6875
Module start 'content' 0.00840.0128 960.03131,009.9141
Module end 'content' 0.02110.0015 1,969.945341.9922
Script end 0.0226  2,011.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002812.1985140.0002
Check MTime0.00115.0531140.0001
Mysql Total
Database connection0.00073.029110.0007
Mysqli_queries0.00219.274530.0007
Looping result0.00000.038910.0000
Template Total0.00115.010.0011
Template load0.00083.748310.0008
Template processing0.00031.199710.0003
Override
Cache load0.00062.570710.0006
General
dbfile0.00104.611580.0001
String conversion0.00000.030540.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