Forums / General / Fetch only nodes with children
Zdenek Ziegler
Thursday 15 June 2006 5:17:53 am
Hello, is it possible to fetch only nodes with children - can I use attribute filter or how to do this? Thanks in advance,Zdenek
Matthew Carroll
Saturday 24 June 2006 11:02:18 am
I don't think that you can use an attribute filter to do that. An extended_attribute_filter, maybe, but much easier, I think, would be to fetch all the nodes then 'filter' them in the template, using children_count. Assuming you've fetched the array of nodes as $list, something like:
{foreach $list as $listitem} {if ne( $listitem.children_count, 0 )} ...... {/if} {/foreach}
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/objects/ezcontentobjecttreenode
Hope that helps...Matthew
http://carroll.org.uk
Milad P
Sunday 25 June 2006 7:36:49 am
how do you limit the loop?
Eq. After that i have fetched and checked with children_count that the objecvt have a child, then i only want it to show say top three objects. How do i limit it?
//Milad