eZ Community » Forums » Developer » Finding subfolders
expandshrink

Finding subfolders

Finding subfolders

Monday 07 March 2005 5:27:39 pm - 2 replies

I have a template that's going to show news from the latest folder in the latest folder in my news folder (the "march" folder under folder "2005"blunk.gif Emoticon

I get the first level but it seems the sections cannot be nested or something. Anyone got any clue of what might cause this, or is there another better way?

Here is the template code:

{* Find last created news folder on top level. *}
{let last_year=fetch('content', 'list', 
	hash( 'parent_node_id', 73 ,
		sort_by,array( 'published',  false() ) , 
		'limit', 1, 
		'class_filter_type',  'include',
       		'class_filter_array', array( 'folder' ) )  )
              
}
	{* Find last created subfolder again *}
	{section name=siste_mnd loop=$last_year max=1}
		{let siste_folder2=fetch('content', 'list', 
			hash( 'parent_node_id', $siste_mnd:item.node_id,
			sort_by, array(  'published',  false() ) , 
			'limit', 1)  
			)
		}
	          
        
        {section name=hoved loop=$siste_folder2 max=1}
				{$hoved:item|attribute(show,3)}
	{/section}
		
	{/let}
	
	{/section}	
	
{/let}

the second section wont show anything even if I hardcode the parent_node_id to latest folder

Modified on Monday 07 March 2005 5:28:09 pm by Olav Bringedal

Monday 07 March 2005 6:34:02 pm

Hi Olav,

Try

{$siste_mnd:hoved:item|attribute(show,3)}

instead of

{$hoved:item|attribute(show,3)}

Tuesday 08 March 2005 10:06:07 am

Thanks but i didn't get that to work, but it might as well be my impatience having the fault happy.gif Emoticon

However the following does work and only makes one hit on the DB:

{* Find last created news folder on top level. *}
{let last=0 current_year=fetch('content', 'list', 
	hash( 'parent_node_id', 73 ,
		sort_by,array( 'published',  false() ) , 
		'limit', 1, 
		'class_filter_type',  'include',
        'class_filter_array', array( 'folder' ) )  )}
			
	siste måned: {$current_year.0.children[$current_year.0.children_count|dec]|attribute(show,2)}
	
{/let}

Drawback is that it doesn't filter out other objects than folders from the parent folder.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu