Forums / Developer / Fetching content from multimple nodes..

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Fetching content from multimple nodes..

Author Message

K259

Friday 23 April 2004 5:38:19 am

It's easy I guess, but I haven't found any doc on this.
How can I fetch content(children) for mynode from multiple nodes?
Let's say I want for "mynode" to get objects from nodes with ID 42, 44 and 46.

This is the code for fetching from 1 node:
{let mynode=fetch(content,node, hash(node_id, 42)}

And what's the syntax for multiple nodes?

Eirik Alfstad Johansen

Friday 23 April 2004 6:07:17 am

Hi Zinistry,

Are you referring to something like this?

{let children=fetch('content', 'list', hash(parent_node_id, $node_id.parent_node_id))}

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

K259

Friday 23 April 2004 6:20:55 am

Nope, sorry. I want to fetch content from multiple nodes. Let's say I want on a page to list the 6 latest news from different categories with different parents.

For example:
I got a news site based on categories: News/economy/articles, News/travel/articles, Info/music/articles, Mobile/news/articles..

The list with the 6 latest news shall list the content(articles) from the categories above in just one fetch.

Eirik Alfstad Johansen

Friday 23 April 2004 7:02:22 am

Hi Zinistry,

Then I would do a fetch using node 2 as the parent, specifying the article class in the class_filter_array, and going the neccessary levels deep. Something like this:

{let articles=fetch(content, list, hash(limit, 6, parent_node_id, 2, depth, 3, sort_by,array(published,false()), class_filter_type, include, class_filter_array, array(article)) )}

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

K259

Friday 23 April 2004 7:11:19 am

But then I get articles from categories I don't want to include :)
And that's not what I want, sorry ;)

Ole Morten Halvorsen

Friday 23 April 2004 7:26:17 am

Zinistry,

You can fetch a list from multiple nodes.

This should work:

{let articles=fetch( content, list, hash( parent_node_id, array( $id1, $id2, $id3 ) ) )}

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

K259

Friday 23 April 2004 10:14:22 am

Great! Tnx Ole! :)

I'll try it later in the evening!

Mikhail Chekanov

Monday 11 April 2005 9:01:39 am

{let articles=fetch( content, list, hash( parent_node_id, array( $id1, $id2, $id3 ) ) )}

Can anyone confirm that it does work with 3.5.1?
Doesn't work for me :(

--
mike
#6595551