Share » Forums » Setup & design » fetching items with various locations

fetching items with various locations

fetching items with various locations

Wednesday 28 July 2004 7:27:44 am - 5 replies

Author Message

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

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu