Finding subfolders

Author Message

Olav Bringedal

Monday 07 March 2005 8:27:39 am

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")

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


Senior Consultant
http://Umoe-consulting.no

Eirik Alfstad Johansen

Monday 07 March 2005 9:34:02 am

Hi Olav,

Try

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

instead of

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

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Olav Bringedal

Tuesday 08 March 2005 1:06:07 am

Thanks but i didn't get that to work, but it might as well be my impatience having the fault :)

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.


Senior Consultant
http://Umoe-consulting.no

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.