Sunday 20 February 2005 2:55:42 pm - 5 replies
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
Sunday 20 February 2005 10: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
Modified on Sunday 20 February 2005 10:17:44 pm by Arran Price
Monday 21 February 2005 12:36:29 am
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.
Monday 21 February 2005 1:17:25 am
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 1:51:04 pm
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 3:34:12 pm
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}
You must be logged in to post messages in this topic!