Forums / Setup & design / sorting fetch

sorting fetch

Author Message

risto CMS user

Tuesday 07 February 2006 2:47:12 am

I have this code

<ul>
{section name=Child loop=fetch( content,
                     list,
                     hash( 
                           parent_node_id,    110,
                           limit,                    5,
                           class_filter_type,  include,
                           class_filter_array, array( 'article' )
						  ))}

<li>{node_view_gui view=listitem content_node=$Child:item}</li>
						   
{/section}
</ul>

can someone explain how to use sortby her?
both sorting by published and name

Massimo Sanna

Tuesday 07 February 2006 3:08:09 am

Hi there, you have to use the sort_by directive in your fetch.
More info here:
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/modules/content/fetch_functions/list

Since you're going to sort items by published and name you have to use an array, like this

{section name=Child loop=fetch( content,list,hash(parent_node_id,110,limit,5,class_filter_type, include,class_filter_array, array( 'article' ),'sort_by',array( array( 'published',false() ), array( 'name', false() )))}

Hope this is helpful!
Max

risto CMS user

Tuesday 07 February 2006 4:44:55 am

perfect thanx ;-)