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

Author Message

Jerry Jalava

Thursday 06 November 2003 7:33:33 pm

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

Ole Morten Halvorsen

Friday 07 November 2003 1: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_3/documentation/development/libraries/ez_template/operators/data_fetch and http://ez.no/developer/ez_publish_3/documentation/customization/tips_tricks/fetch_function_examples for more documentation on the fetch function.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Jerry Jalava

Friday 07 November 2003 4:11:01 am

Hi,

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

Thanks again,
Jerry

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.