Fetch Children

Author Message

Softriva .com

Monday 19 February 2007 6:39:44 am

Hello,

I have the following content strcuture

News (N65)
--2005
----News1
----News22
--2006
----News3
----News11
----News14
----News26
--2007
----News12
----News10

I only can know the news folder node id which 65 and of course the year. How can I fetch the children?

I tried this but not sure if it's ok

{def latest_news=fetch( 'content', list, hash( 'parent_node_id', 65,
				'sort_by', array( 'published', false() ),
				 'limit',3,
                                 'attribute_filter', array( array( 'folder/name','=',$CurrentYear))

Nabil Alimi

Monday 19 February 2007 8:54:20 am

Hi,

Which content do you want to retrieve ? How would you like to sort it ?

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Softriva .com

Monday 19 February 2007 9:46:09 am

oooooops,

sorry, I want to fetch the news1, news22, news14, etc.

Damarev .

Monday 19 February 2007 6:45:29 pm

This could be a simple solution:

{def $current_folder=fetch( 'content', list, hash( 'parent_node_id', 65,
'limit',1,
'attribute_filter', array( array( 'folder/name','=',$CurrentYear))
}

{def $last_folder_id=$current_folder[0].node_id}

{def $latest_news=fetch( 'content', list, hash( 'parent_node_id', $last_folder_id,
'sort_by', array( 'published', false() ),
}

I know this is not the perfect approach, but it works.

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