Forums / Developer / Template problem... Pls. Give a hint...

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

eZ debug

Timing: Jan 18 2025 11:14:44
Script start
Timing: Jan 18 2025 11:14:44
Module start 'content'
Timing: Jan 18 2025 11:14:44
Module end 'content'
Timing: Jan 18 2025 11:14:45
Script end

Main resources:

Total runtime0.7686 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0096 588.8516180.8281
Module start 'content' 0.00960.6105 769.6797511.4609
Module end 'content' 0.62020.1484 1,281.1406333.5000
Script end 0.7685  1,614.6406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.5709210.0002
Check MTime0.00170.2185210.0001
Mysql Total
Database connection0.00100.132810.0010
Mysqli_queries0.686389.29511940.0035
Looping result0.00200.25641920.0000
Template Total0.732995.420.3665
Template load0.00210.268620.0010
Template processing0.730995.088920.3654
Template load and register function0.00020.030610.0002
states
state_id_array0.00100.136510.0010
state_identifier_array0.00080.100720.0004
Override
Cache load0.00180.2326400.0000
Sytem overhead
Fetch class attribute can translate value0.00170.224530.0006
Fetch class attribute name0.00220.280130.0007
XML
Image XML parsing0.00050.061730.0002
class_abstraction
Instantiating content class attribute0.00000.001130.0000
General
dbfile0.00400.5264210.0002
String conversion0.00000.001230.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs