Forums / General / Fetching an array of 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 an array of nodes

Author Message

Jonathan Marsigny

Wednesday 26 January 2005 2:54:16 am

Hello,

I try to do this :

$my_array=(1,2,3,4)
{let nodes=fetch(content,node,hash(node_id,$my_array))}

Can you confirm it doesn't work ?

Regards

Balazs Halasy

Wednesday 26 January 2005 5:29:23 am

Hi,

This will not work because the content/node fetch expects a single node ID and not an array of node IDs. What is it that you want to do? Maybe we can help you..

Allman

Jonathan Marsigny

Wednesday 26 January 2005 7:12:00 am

I want to fetch some nodes to build menu.
I have some questions.

1) Can I do fetch in {case} {/case}?
2) How can fetch an array of nodes and write their name.

My code :

{let 	  anonyme=array(58)
		formateur=array(58,59,60,61)
		contact=array(58,59,60,61,105,64)
		user_courrant=fetch(user,current_user)
		group_courrant=$user_courrant.contentobject.parent_nodes}
		
<ul>
{let data=fetch(content,node,hash(node_id,$anonyme.0))}
{section loop=$formateur}
{let data2=fetch(content,node,hash(node_id,$formateur.$i)
$i=$i+1
{/section}

{switch name=element match=$group_courrant.0}
{case match=44}
<li><a href={$data.url_alias|ezurl}>{$data.name|wash}</a></li>
{/case}
{case in=array(73,76,79)}
{* some names here from an array*
......
...

Jonathan Marsigny

Friday 28 January 2005 2:49:45 am

ok, finally I use this :

$formateur=array...

{section loop=$formateur}
{set b=fetch(content,node,hash(node_id,$:item))
}
<li><a href={$b.url_alias|ezurl}>{$b.name|wash}</a></li>
{/section}