how to setup a menu with only specific folders

Author Message

elaheh tabbakh maher

Saturday 07 March 2009 5:25:09 pm

Hi,
Can someone tell me how to setup a menu from only specific folders, I have to show a menu in a template with only ;
Folder 1
Folder4
Folder5

Thank you,

Jean-Yves Zinsou

Sunday 08 March 2009 5:21:42 am

Hi,
you could add some checking in the loop displaying the folders ...

{def folder1_id=123,
folder2_id= 134, 
folder3_id=233}
{def $folders_to _display=array($folder1_id, $folder2_id, $folder3_id)}
{foreach $children as $child}
{if $folders_to_display|contains($child)}
{*display the entry*}
{/if}

{/foreach}

Code not tested, but that is the idea...

HTH

jey

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

elaheh tabbakh maher

Sunday 08 March 2009 10:35:18 am

Hi,
I am using the double_top.tpl with topdrop extension and the code for showing the first level is as follow and I am not sure where in that code should be changed with your suggestion:
------------------------------------

{def $base=fetch( 'content', 'node', hash( 'node_id', 2 ) )} {* FIRST LEVEL *} {def $i=0} {section loop=fetch(content,list,hash(parent_node_id,$top_cat, class_filter_type, "include", class_filter_array, array(1, 16, 17, 19, 20, 23, 38, 39),sort_by,$base.sort_array))} {let child_check=fetch(content,list,hash(parent_node_id,$:item.node_id, class_filter_type, "include", class_filter_array, array(1, 16, 17, 19, 20, 23, 38, 39),sort_by,$base.sort_array))} {set $i=inc( $i )}
<li><a class="{concat('menu_',$i)}" href={$:item.url_alias|ezurl}>{$:item.name}

{section show=$child_check|count|gt(0)}

{* SECOND LEVEL *}
<!--[if IE 7]><!--></a><!--<![endif]-->
------------------------------------------------------------------------------------------------

Thank you

Jean-Yves Zinsou

Sunday 08 March 2009 10:58:25 am

I am not very familiar with the section loop but this is where i would put it...


{def $base=fetch( 'content', 'node', hash( 'node_id', 2 ) )} 
{* FIRST LEVEL *} 
{def $i=0}
 {section loop=fetch(content,list,hash(parent_node_id,$top_cat, class_filter_type, "include", class_filter_array, array(1, 16, 17, 19, 20, 23, 38, 39),sort_by,$base.sort_array))} 
{*-----------your checking here start-------------*}
{if $folders_to_display|contains($:item.node_id)}

{let child_check=fetch(content,list,hash(parent_node_id,$:item.node_id, class_filter_type, "include", class_filter_array, array(1, 16, 17, 19, 20, 23, 38, 39),sort_by,$base.sort_array))} {set $i=inc( $i )}

<li><a class="{concat('menu_',$i)}" href={$:item.url_alias|ezurl}>{$:item.name}

{section show=$child_check|count|gt(0)}

{* SECOND LEVEL *}
<!--[if IE 7]><!--></a><!--<![endif]-->

{/section}
{*-----------your checking here end------------*}
{/end if}
{/section}

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

elaheh tabbakh maher

Friday 13 March 2009 4:34:50 am

Hi,
Thank you for your help, but this code does not work, it puts a strange menu out of where it should appear and it does not appear and does not work with double_top.tpl.
Regards

Jean-Yves Zinsou

Friday 13 March 2009 5:01:40 am

Hi , it is because it was not clear enough.

The code you gave is incomplete ,


{def $base=fetch( 'content', 'node', hash( 'node_id', 2 ) )} {* FIRST LEVEL *} {def $i=0} {section loop=fetch(content,list,hash(parent_node_id,$top_cat, class_filter_type, "include", class_filter_array, array(1, 16, 17, 19, 20, 23, 38, 39),sort_by,$base.sort_array))} {let child_check=fetch(content,list,hash(parent_node_id,$:item.node_id, class_filter_type, "include", class_filter_array, array(1, 16, 17, 19, 20, 23, 38, 39),sort_by,$base.sort_array))} {set $i=inc( $i )}
<li><a class="{concat('menu_',$i)}" href={$:item.url_alias|ezurl}>{$:item.name}

{section show=$child_check|count|gt(0)}

{* SECOND LEVEL *}
<!--[if IE 7]><!--></a><!--<![endif]-->


{*code missing here there should be a /section somewhere*}
 

in fact you have to replace the code section you gave with



{def $base=fetch( 'content', 'node', hash( 'node_id', 2 ) )} 

{* FIRST LEVEL *} 

{def $i=0}


 {section loop=fetch(content,list,hash(parent_node_id,$top_cat, class_filter_type, "include", class_filter_array, array(1, 16, 17, 19, 20, 23, 38, 39),sort_by,$base.sort_array))} 

{*-----------your checking here start-------------*}


{if $folders_to_display|contains($:item.node_id)}
{let child_check=fetch(content,list,hash(parent_node_id,$:item.node_id, class_filter_type, "include", class_filter_array, array(1, 16, 17, 19, 20, 23, 38, 39),sort_by,$base.sort_array))} {set $i=inc( $i )}
 
<li><a class="{concat('menu_',$i)}" href={$:item.url_alias|ezurl}>{$:item.name}
{section show=$child_check|count|gt(0)}

{* SECOND LEVEL *}
<!--[if IE 7]><!--></a><!--<![endif]-->

Then find the next {/section} tag
and add

{/end if}

after it

Sorry, things that may be obvious for one, may not be to others.
My apologies.

Hope this really helps this time ;-)
Jey

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

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 18 2025 19:01:31
Script start
Timing: Jan 18 2025 19:01:31
Module start 'layout'
Timing: Jan 18 2025 19:01:31
Module start 'content'
Timing: Jan 18 2025 19:01:31
Module end 'content'
Timing: Jan 18 2025 19:01:31
Script end

Main resources:

Total runtime0.0233 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.0091 588.0469152.6406
Module start 'layout' 0.00910.0058 740.687539.4922
Module start 'content' 0.01490.0062 780.179797.4922
Module end 'content' 0.02110.0021 877.671942.3047
Script end 0.0233  919.9766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002812.1023140.0002
Check MTime0.00114.7896140.0001
Mysql Total
Database connection0.00125.132810.0012
Mysqli_queries0.005925.427230.0020
Looping result0.00000.115410.0000
Template Total0.00177.210.0017
Template load0.00093.893810.0009
Template processing0.00083.286010.0008
Override
Cache load0.00062.506710.0006
General
dbfile0.00114.812180.0001
String conversion0.00000.051140.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