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.