Can not fetch my "home made" objects...

Can not fetch my "home made" objects...

Tuesday 19 December 2006 8:05:04 am - 4 replies

Author Message

Claudia Kosny

Wednesday 20 December 2006 1:18:49 am

Hi Milad

Is the problem caused by the fetch functions or by the loop? Do you get any messages in debug output?

You cannot use {def ... in a loop as you can define a variable only once in a template. So you either {undef $nr} in the loop again or you put {def $nr = 0} (or so) before the loop and use {set $nr = ...} in the loop.

Check whether $children_count and $children contain anything. Check whether $children[$nr].object.data_map.name exists (maybe you have a typo in your class definition).

Regarding the loop itself: if you just want to have a random node where the attribute name contains something, it might be more efficient to limit the fetch to these noses using the attribute filter and to use the limit and offset parameter to fetch just one node.

For fetching random content see here:
http://ez.no/community/forum/setup_design/how_to_fetch_random_content_3_8/re_how_to_fetch_random_content_3_8

Claudia

Milad P

Wednesday 20 December 2006 5:58:38 am

Hi again,

The problem is in the fetch line. $children and $children_count contains nothing. $children returns a empty array and $children_count = 0.

//Milad

Claudia Kosny

Wednesday 20 December 2006 1:02:34 pm

Hi Milad

Do you see your custom objects in the admin view under the specified parent node?
If not, you have the wrong parent node.
If yes, I think there is something wrong with either the visibility, the permissions or the translations of your custom objects. So add the following parameters to your fetch parameters:

'ignore_visibility' => true(),
'limitation' => array(),
'only_translated' => false()

Clear the cache and try again. Does that help?

Claudia

Milad P

Thursday 21 December 2006 1:18:57 am

Thank you for your advise. It seems that i have forgot to set the proper permissions for my new object. Problem solved.

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.