Menu showing all folders and subfolders ?

Author Message

Lex 007

Thursday 10 February 2005 5:11:19 am

I would like to make a menu showing ALL folders and subfolders at the same time. For example :

Folder 1
-- SubFolder 1.1
-- SubFolder 1.2
------ SubFolder 1.2.1
------ SubFolder 1.2.2
Folder 2
-- SubFolder 2.1
-- SubFolder 2.2

I tried using the treemenu operator but it seems it can only display subfolders of one specific node.

Thanks in advance for your help.

Felix Laate

Thursday 10 February 2005 5:32:59 am

Hi!

I'm sure there are many better ways than this one, but anyways...

{* Set your top category here *}
{let top_cat=2 used_node=false()}

{* See if we have already a node id otherwise use the top category as current node *}
{section show=is_set($DesignKeys:used.node)}
{set used_node=$DesignKeys:used.node}
{section-else}
{set used_node=$top_cat}
{/section}

{* Get a proper node object *}
{let node_obj=fetch(content,node,hash(node_id,$used_node))}

<ul id="nav">

{* FIRST LEVEL *}
{section loop=fetch(content,list,hash(parent_node_id,$top_cat, 
										limit, 6, 
										class_filter_type, "include", 
										class_filter_array, array(1),
										sort_by,array(array(priority))))}
{* check if container *}
				
{switch match=$:item.object.content_class.is_container}	
{* container *}
{case match=1}
<li><a class="path" href={concat("/content/view/full/",$:item.node_id,"/")|ezurl}>{$:item.name}</a>
			
{* fiks 1 start *}
{let c1=fetch(content,list,hash(parent_node_id,$:item.node_id))}	
{section show=$c1}	
<ul>				
{* SECOND LEVEL *}
{section loop=fetch(content,list,hash(parent_node_id,$:item.node_id, 
										class_filter_type, "include", 
										class_filter_array, array(1),
										sort_by,array(array(priority))))}
{* check if container *}
{switch match=$:item.object.content_class.is_container}
{case match=1}
<li><a class="path" href={concat("/content/view/full/",$:item.node_id,"/")|ezurl}>{$:item.name}</a>
					
{* fiks 2 start *}
{let c2=fetch(content,list,hash(parent_node_id,$:item.node_id))}	
{section show=$c2}	
					
<ul>
{* THIRD LEVEL *}
{section loop=fetch(content,list,hash(parent_node_id,$:item.node_id, 
										class_filter_type, "include", 
										class_filter_array, array(1),
										sort_by,array(array(priority))))}
{* check if container *}
{switch match=$:item.object.content_class.is_container}
{case match=1}
<li><a class="path" href={concat("/content/view/full/",$:item.node_id,"/")|ezurl}>{$:item.name}</a>
							
{* fiks 3 start *}
{let c3=fetch(content,list,hash(parent_node_id,$:item.node_id))}	
{section show=$c3}
							
<ul>
{* FOURTH LEVEL *}
{section loop=fetch(content,list,hash(parent_node_id,$:item.node_id, 
										class_filter_type, "include", 
										class_filter_array, array(1),
										sort_by,array(array(priority))))}
{* check if container *}
{switch match=$:item.object.content_class.is_container}
{case match=1}
<li><a class="path" href={concat("/content/view/full/",$:item.node_id,"/")|ezurl}>{$:item.name}</a>
									
{* fiks 4 start *}
{let c4=fetch(content,list,hash(parent_node_id,$:item.node_id))}	
{section show=$c4}

<ul>
</ul>
									
{section-else}        
{/section}
{/let}
			
{* fiks slutt *}
									
</li>
{/case}
{case}
<li><a class="path" href={concat("/content/view/full/",$:item.node_id,"/")|ezurl}>{$:item.name}</a></li>
{/case}
{/switch}
{/section}								
</ul>
							
{section-else}        
{/section}
{/let}
			
{* fiks slutt *}
							
</li>
{/case}
{case}
<li><a class="path" href={concat("/content/view/full/",$:item.node_id,"/")|ezurl}>{$:item.name}</a></li>
{/case}
{/switch}
{/section}	
</ul>
					
{section-else}        
{/section}
{/let}
			
{* fiks slutt *}
					
</li>
{/case}			
{case}
<li><a class="path" href={concat("/content/view/full/",$:item.node_id,"/")|ezurl}>{$:item.name}</a></li>
{/case}
{/switch}
{/section}								
</ul>
			
{section-else}        
{/section}
{/let}
			
{* fiks slutt *}
			
</li>
{/case}
{case}
{* not container *}
<li><a class="path" href={concat("/content/view/full/",$:item.node_id,"/")|ezurl}>{$:item.name}</a></li>
{/case}
{/switch}
{/section}
</ul>

{/let}
{/let}
	
</div>

I used this together with the http://www.csscreator.com/menu/multimenu.php to create (horizontal) dynamic menus. Skip it and it can be made static.

Hope it helps!

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Lex 007

Thursday 10 February 2005 6:02:16 am

Thanks, that's a pretty nice script ... but it doesn't work for me !
Only the folders of level 0 are shown. Any idea ?

Felix Laate

Friday 11 February 2005 1:54:27 am

Hi again!

My example was based on this: http://ez.no/ez_publish/documentation/customization/tips_tricks/creating_tree_menus

Just make sure to get rid of the show-things that says that things should only show if you're at a specific node.

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Marek Zywert

Friday 12 May 2006 8:10:00 am

Hi Lex 007,
I'm looking for this same solution - I'd like to show all menu with subfolders on a site.
Have you found solution?

xsayo

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 22:15:42
Script start
Timing: Jan 18 2025 22:15:42
Module start 'layout'
Timing: Jan 18 2025 22:15:43
Module start 'content'
Timing: Jan 18 2025 22:15:43
Module end 'content'
Timing: Jan 18 2025 22:15:43
Script end

Main resources:

Total runtime0.6942 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.0313152.6406
Module start 'layout' 0.00450.0028 740.671939.4766
Module start 'content' 0.00730.6853 780.1484614.2344
Module end 'content' 0.69260.0015 1,394.382816.1250
Script end 0.6942  1,410.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00290.4116160.0002
Check MTime0.00120.1670160.0001
Mysql Total
Database connection0.00070.101710.0007
Mysqli_queries0.636791.7132650.0098
Looping result0.00060.0818630.0000
Template Total0.665295.820.3326
Template load0.00200.291020.0010
Template processing0.663295.535220.3316
Template load and register function0.00010.015610.0001
states
state_id_array0.00070.105210.0007
state_identifier_array0.00110.161020.0006
Override
Cache load0.00170.2509380.0000
Sytem overhead
Fetch class attribute can translate value0.00060.092630.0002
Fetch class attribute name0.00080.120970.0001
XML
Image XML parsing0.00110.157330.0004
class_abstraction
Instantiating content class attribute0.00000.002290.0000
General
dbfile0.00100.1449220.0000
String conversion0.00000.001040.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/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: 22
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs