Forums / Developer / How Can I create a block for last updated articles ?

How Can I create a block for last updated articles ?

Author Message

Pierre SCALFATI

Tuesday 03 March 2009 3:06:24 am

Hello Everybody,

I'm trying to find a way to get the 2, 3 or 4 last updated articles of each part of my EZP site. Something which could resemble to this and which could be displayed in my homepage :

----------------------------------------------
LAST UPDATES
----------------------------------------------
> Press review
Article title 1
Article title 2
> Photo Gallery
My photo title 1
My photo title 2
> Accredidations
Article title 1
Article title 2
...
Is there any EZP extension which could do the job or shall I have to do it by myself ? If somebody can help me on the fetch command/depth syntax which could help me,

How can I make it possible to parameter saying what number of articles I want to get for each section ?

Many thanks.

Jean-Yves Zinsou

Tuesday 03 March 2009 4:58:26 am

You may find your answer here ....

http://localhost/ezdoc4/4_0/reference/modules/content/fetch_functions/tree.html

fetch( 'content', 'tree',
hash( 'parent_node_id', parent_node_id,
[ 'sort_by', sort_by, ]
[ 'offset', offset, ]
[ 'limit', limit, ]
[ 'attribute_filter', attribute_filter, ]
[ 'extended_attribute_filter', extended_attribute_filter, ]
[ 'class_filter_type', class_filter_type, ]
[ 'class_filter_array', class_filter_array, ]
[ 'only_translated', only_translated, ]
[ 'language', language, ]
[ 'main_node_only', main_node_only, ]
[ 'as_object', as_object, ]
[ 'depth', depth, ]
[ 'depth_operator', depth_operator ]
[ 'limitation', limitation ]
[ 'ignore_visibility', ignore_visibility ] ) )

you may need to do several fetches to get the articles , one fetch for each of the parent nodes press review, photo gallery ...
For each of those, the "limit" parameter allows you to choose how many nodes you want to retrieve...

Hope this helps !

Regards

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

Pierre SCALFATI

Tuesday 03 March 2009 7:28:29 am

OK, I'll try this and tell you if it worked, many thanks :-)