Forums / Developer / last modified articles

last modified articles

Author Message

justin kazadi

Thursday 13 March 2008 3:47:24 am

hello,

 

I have created an instance of frontpage ( dernierarticle ) this instance have : article1,

article2,...., article5 as sub items .

I want to post only four last modified article what can i do?

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

André R.

Thursday 13 March 2008 1:15:16 pm

http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/list

Probably something like:

{def $articles = fetch('content', 'list', hash( 'parent_node_id', 2,
                                                  'limit', 4,
                                                  'class_filter_type', 'include',
                                                  'class_filter_array', array( 'article' )
))}

where 2 is the node of the frontpage and 'article' is the class identifier of the article class.
Then you need to loop over them, like this:

{foreach $articles as $article}
{$node.name}<br />
{/foreach}

Take a look at this guide for what you can do next:
http://ez.no/ezpublish/documentation/building_an_ez_publish_site

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

justin kazadi

Friday 14 March 2008 3:05:52 am

hello !!

Thanks a lot of ANDRE R . I have done what you say but i want to have only the 4

most recently modified articles of the parent_node_id=189.

Your code return the first four article of the parent_node_id .

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

André R.

Friday 14 March 2008 3:31:37 am

It was just an example, switch 2 with 189 and it should work.
Check the 1. link for more examples using different filters.
The same code can also be used for subtree fetches by changing out 'list' with 'tree'.

To get the 4 most recent modified, look at that page for how to sort ( look for 'sort_by' ) on modified or publish dates.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

justin kazadi

Friday 14 March 2008 6:46:22 am

hello André R !!
Thanks you for all.

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein