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.

eZ debug

Timing: Jan 31 2025 01:19:29
Script start
Timing: Jan 31 2025 01:19:29
Module start 'layout'
Timing: Jan 31 2025 01:19:29
Module start 'content'
Timing: Jan 31 2025 01:19:29
Module end 'content'
Timing: Jan 31 2025 01:19:29
Script end

Main resources:

Total runtime0.0284 sec
Peak memory usage8,192.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 589.2734151.2109
Module start 'layout' 0.00570.0048 740.4844220.7031
Module start 'content' 0.01060.0163 961.1875997.6953
Module end 'content' 0.02680.0016 1,958.882833.9922
Script end 0.0284  1,992.8750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002910.1202140.0002
Check MTime0.00124.2405140.0001
Mysql Total
Database connection0.00072.438610.0007
Mysqli_queries0.004014.066330.0013
Looping result0.00000.052810.0000
Template Total0.00124.110.0012
Template load0.00093.184410.0009
Template processing0.00030.911010.0003
Override
Cache load0.00062.259110.0006
General
dbfile0.003713.047180.0005
String conversion0.00000.025240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs