fetching items with various locations

Author Message

Marko Žmak

Wednesday 28 July 2004 7:27:44 am

I have two folders: "News" and "Science". I would like to display a list of those and only those articles that have this two folders for their location.
Is there any posibility to make a criteria for the fetch function that would fetch only theese folders?

Please help.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Nicolas Heiringhoff

Thursday 29 July 2004 2:40:06 am

Hello,

You could use this code to display the title, intro and body for all the articles in your "News" folder


{* Fetch everything that is under node #296 (children, grand-children, etc.) *}
{let nodes=fetch( 'content', 'tree', hash( 'parent_node_id', 296 ) ) }

{* Loop through the nodes and display their names. *}
{section loop=$nodes}



<br />
    <a href={concat("/content/view/full/",$:item.node_id)|ezurl}>{$:item.data_map.title.data_text}</a>
    
    <br />
    {$:item.data_map.intro.data_text}
    
    <br />
    
    {$:item.data_map.body.data_text}

    <br />    

{/section}



{/let}

simply replace the node id 296 with the node id of your "News"-folder.

For displaying all the articles in your "Science"-folder, simply use the code above another time, with the node id of the "Science"-folder.

this should work.

Nico

http://www.heiringhoff.de

Silke Fox

Thursday 29 July 2004 5:12:16 am

You can also use an array of node ids for fetch functions.

{let nodes=fetch( 'content', 'tree', hash( 'parent_node_id', array( <node1>, <node2> ) ) ) }

Marko Žmak

Thursday 29 July 2004 10:05:02 am

Nicolas, I think that you didn't understand my problem but Silke did.
Thanks Silke, I'll give it a try. Does the fetch function use "AND" or "OR" operator on nodes in the nodes array in your example. For my problem, I need "AND"...

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Silke Fox

Thursday 29 July 2004 12:13:29 pm

Marko,
yes, it is "AND".
The result is an array of your "News" and "Science" objects.
That way you can also sort all objects from these two nodes in one list.

Silke

Marko Žmak

Thursday 29 July 2004 2:21:20 pm

Thanks a lot.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

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