This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Install & configuration » New ez user, trying to use 'fetch'.

New ez user, trying to use 'fetch'.

New ez user, trying to use 'fetch'.

Tuesday 28 January 2003 1:22:34 am - 6 replies

Im brand new to ez and ez publish 3. Im trying to understand the 'fetch' template function - its rather difficult without documentation (if ive missed it can someone point me to it? thanks!).

Like the earlier 'Folders and custom views' post, i want to have a custom view for a folder. I looked around and it seems: user/override/templates/node/view/full_class_1.tpl defines how folders are viewed for the provided demo site. I thought I could use that file, change it a bit, but no joy there.

Within that folder i have objects for a class i created. Without overriding the folder view i see the simple folder information when i move to that node, whereas i would like to see my objects rendered according the full or list tpl's.

At the moment it appears my understanding of the fetch function needs improving. The examples Ive seen vary and customising these has been hit/miss.

Any help would be appreciated.



Tuesday 28 January 2003 8:24:23 am


generally, fetch is used to select nodes from EZ content tree. It can filter nodes by their class (e.g. select only Folders or only Products), sort its results by several criteria (e.g. publish dates) and limit the number of resulting nodes (e.g. select 10 nodes only, or select 10 nodes starting with 100'th).

You could dig in existing templates, esp. in STANDARD folder, to see various fetch examples, I am afraid this is the only documentation available.

Tuesday 28 January 2003 10:55:52 am


The fecth function template is for execution of functions on templates. It have 3 parameters:

fecth( <module>, <function>, <parameters> ),

where <parameters> is an associative array which supply <function>'s parameters.

How acts <function> (and parameters) is defined in [module]/function_definition.php.

I hope this help you.

Adolfo Barragán

Tuesday 28 January 2003 11:46:05 am

Ah, I didn't realise the first parameter was related to a module within kernel. I thought at first it matched a class group, ie 'fetch within group'...

Hope you don't mind the included code. I think my fetch function is now the simplest it can be... My code for displaying the contents of the folder is now:

{let test=fetch(content,list,hash(parent_node_id,220))}

i am here.

{section name=MyList loop=$test}

i am now here.

{node_view_gui view=line content_node=$MyList:item}


But when run the code does not enter the section loop. Is there a way to display the contents of the list returned by fetch? It appears the list is emtpy, which is odd as i have two published objects underneath node 220.

As another test i added an article to that node and found that fetch did return with it, but still ignores my other objects.

It looks like ive done something wrong with the class and its instances, and fetch is not picking them up.

I could go into more detail here, but from what ive said so far is there anything ive obviously missed?

looking forward to more docs in rc2 happy.gif Emoticon


Tuesday 28 January 2003 1:53:15 pm

I think I have found out why fetch does not return the objects i have in my folder.

If i reference my new class instance directly, hoping to see the full view, i get this kernel error:


* The object is not available.

If i reference a created Article in the same folder it works as expected.

This may explain why fetch doesn't return them.

But... I cant see why my objects have not been created. They are published. I can view and edit them within the admin site just as i can view and edit the Article in the folder.

Any ideas about this?

Tuesday 28 January 2003 2:07:03 pm

> If i reference my new class instance directly, hoping to see
> the full view, i get this kernel error:

I don't sure, but I have to labour with a similar problem (my fetch only fetches some objects, but not my new classes).

In a message in this forum ( ) Jan Borsodi reply me the correct solution.

I hope this help you.

Adolfo Barragán

Tuesday 28 January 2003 7:20:12 pm

Bingo! Adolfo, thanks.

Wow, this is really non-obvious. I didn't for one moment think that the (anon) user was set up to only view pre-created classes.

I hope ez use better error messages in future. I'll look at the bug reports later to see if this is mentioned as the error message should say something about permissions instead of what i got.

Again, thanks.



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

36 542 Users on board!

Forums menu

Proudly Developed with from