Forums / Setup & design / Understanding Fetch

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