Understanding Fetch

Author Message

Richard Cesar

Sunday 03 April 2005 8:58:38 pm

Hello,

First off I am having problems finding any sort of basic syntax referance for ez-publish, and having some would make asking these questions rather pointless, so if you can direct me to one that would be a help, otherwise, please continue :).

At the moment my problem centers around the most major component of the template, the fetch() function. My original idea was to stream information (articals, weblogs, etc.) from multiple nodes, all on the home page, the problem is there is no information on potential commands for the hash function that I seem to find used within fetch.., and everything I have been trying has failed to yield reasonable output. What I attempted doing was to fetch content from multiple parent nodes (specified in the hash) limit it to a maximum amount of each (at 3 articals/weblogs/etc), seems like fairly basic stuff, in fact I could swear for a second I had it working, but how I accomplished it I have no idea. As For the parent node I tried both the content folder, and the section node id, neither of which proved to give any sort of information. I planned on using multiple fetch statements to stream content from multiple nodes, but so far this just isnt working. Any advice, pointers, referances, etc. you could provide would be helpfull... if anyone can say what they did in this case that would also work.

Using 3.5.1

Thanks,
Richard

Ekkehard Dörre

Monday 04 April 2005 12:34:10 am

Hi Richard,

welcome.

It is interesting to see, who and when somebody does some changes on the page, so I made a listing of the latest 40 modified objects, where 2 is the main node of content:

{let news_list=fetch( content, tree, hash( parent_node_id, 2,
                                           limit, 40,
                                           sort_by, array( array( modified , false()) )

                                         ) )}
    {section name=News loop=$news_list}

    <div class="newstitle"><a href={$News:item.url_alias|ezurl}>{$News:item.name|wash}</a></div>

      <div class="date">Published: ({$News:item.object.published|l10n( datetime )})Modified: ({$News:item.object.modified|l10n( datetime )}) by  {$News:item.creator.name}</div>

    {/section}

{/let}

the latest 40 published objects ( only modified is changed to published):

{let news_list=fetch( content, tree, hash( parent_node_id, 2,
                                           limit, 40,
                                           sort_by, array( array( published , false()) )

                                         ) )}
    {section name=News loop=$news_list}

    <div class="newstitle"><a href={$News:item.url_alias|ezurl}>{$News:item.name|wash}</a></div>

      <div class="date">Published: ({$News:item.object.published|l10n( datetime )})Modified: ({$News:item.object.modified|l10n( datetime )}) by  {$News:item.creator.name}</div>

    {/section}

{/let}

Greetings, ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Ekkehard Dörre

Monday 04 April 2005 12:44:30 am

2 is the parent node.
More info:

http://www.ez.no/ez_publish/documentation/customization/tips_tricks/fetch_function_examples

http://www.ez.no/ez_publish/documentation/customization/custom_design/database_connectivity

http://www.ez.no/ez_publish/documentation/reference/data_fetching/content

the mostimportant is tree and list.
http://www.ez.no/ez_publish/documentation/reference/data_fetching/content/tree

http://www.ez.no/ez_publish/documentation/reference/data_fetching/content/list

Greetings, ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

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 19 2025 09:05:38
Script start
Timing: Jan 19 2025 09:05:38
Module start 'layout'
Timing: Jan 19 2025 09:05:38
Module start 'content'
Timing: Jan 19 2025 09:05:38
Module end 'content'
Timing: Jan 19 2025 09:05:38
Script end

Main resources:

Total runtime0.0182 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 589.1484152.6250
Module start 'layout' 0.00680.0034 741.773439.4297
Module start 'content' 0.01020.0054 781.203193.4141
Module end 'content' 0.01560.0025 874.617234.3047
Script end 0.0181  908.9219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002715.1352140.0002
Check MTime0.00126.3942140.0001
Mysql Total
Database connection0.00179.099510.0017
Mysqli_queries0.002715.010430.0009
Looping result0.00000.082710.0000
Template Total0.002111.610.0021
Template load0.00126.681810.0012
Template processing0.00094.881310.0009
Override
Cache load0.00073.690210.0007
General
dbfile0.00063.579980.0001
String conversion0.00000.043340.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