This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » Template problem... Pls. Give a hint...
expandshrink

Template problem... Pls. Give a hint...

Template problem... Pls. Give a hint...

Friday 07 November 2003 4:33:33 am - 2 replies

Hi,

I'm using the 3.2-3 release of eZP.

Is there a possibility to complete this kind of task in template code:

I have folder "Articles" and there folders that are the categories.
In the category folders I have my articles.

I need to fetch on my frontpage 5 newest articles. They have to come from all the categories...

I just has to show the category the article belongs to and the title of the article...

So the fetching should check 22 category folders for newest articles and show only 5 newest of them...
But I don't know how to build that kind of fetch...

Thanks,
Jerry

Friday 07 November 2003 10:12:24 am

If my understanding is correct, you have a tree structure like this:

articles
-- category 1
---- article 1
---- article 2
-- category 2
---- article 3
---- article 4

Template example of how to fetch the five newest articles:

{let articles=fetch( content, tree, hash( parent_node_id, NODE_ID,
sort_by,array( published, false() ),
limit, 5,
class_filter_type, include,
class_filter_array, array( 'article' ) ) )}

{section name=Child loop=$articles}
{node_view_gui view='line' content_node=$:item}
{/section}

{/let}

Replace NODE_ID with the node id to the article folder.

See also http://ez.no/developer/ez_publish...ies/ez_template/operators/data_fetch and http://ez.no/developer/ez_publish.../tips_tricks/fetch_function_examples for more documentation on the fetch function.

Modified on Friday 07 November 2003 10:12:47 am by Ole Morten Halvorsen

Friday 07 November 2003 1:11:01 pm

Hi,

Thanks Ole! It worked out just fine... I don't know why didn't I thought so simple way to do i... happy.gif Emoticon I was just about to make an module that fetches the newest articles like that... happy.gif Emoticon

Thanks again,
Jerry

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from