Forums / Setup & design / fetch all articles

fetch all articles

Author Message

risto CMS user

Tuesday 07 February 2006 8:43:01 am

Id like to fetch all publishd articles no matter where they are published an display thee latest 10. Can someone show me this? I cant figure out how to make it independent of "location"

Stephen Martin

Tuesday 07 February 2006 2:03:17 pm

I think you're looking for the Tree function:

http://ez.no/doc/ez_publish/technical_manual/3_6/reference/modules/content/fetch_functions/tree

You can limit the results to 10 and select that you only want to return a list of articles by defining the class_filter_type.

Steph A

Saturday 11 February 2006 10:59:19 am

This code fetches nodes under the mainnode. Just set "depth" and "limit" to desired value.

{* Fetch some content *}
{let children=fetch( content, list, hash( parent_node_id, 2,
                                     sort_by, array( published, false() ),
                                     depth,10,
                                     limit,10,
                                     class_filter_type, include,
                                     class_filter_array, array( 'article' ) ) )}
{section name=Child loop=$children}
    {node_view_gui view=line content_node=$Child:item}
{/section}
{/let}