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

New ez user, trying to use 'fetch'.

New ez user, trying to use 'fetch'.

Monday 27 January 2003 4:22:34 pm - 6 replies

Author Message

sergey podlesnyi

Monday 27 January 2003 11:24:23 pm

Hi,

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.

Adolfo Barragán

Tuesday 28 January 2003 1:55:52 am

Hello:

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.

Regards
Adolfo Barragán

Paul Forsyth

Tuesday 28 January 2003 2: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}

{/section}
{/let}

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 :)

paul

Paul Forsyth

Tuesday 28 January 2003 4:53:15 am

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:

Unavailable

* 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?

Adolfo Barragán

Tuesday 28 January 2003 5:07:03 am

> 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 ( http://developer.ez.no/forum/message/13260/ ) Jan Borsodi reply me the correct solution.

I hope this help you.

Regards
Adolfo Barragán

Paul Forsyth

Tuesday 28 January 2003 10:20:12 am

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.

paul

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

36 542 Users on board!

Forums menu