more related objects questions

Author Message

j jevack

Wednesday 09 November 2005 5:29:08 am

I have read much on the forums regarding related objects and I'm still having trouble understanding how to output related objects.

I have an article-type class which can have image objects related to it. I would like to display the related objects at the bottom of each article. I don't want to embed the images in the article text, just simply loop thru them and display them at the end of the article.

I have successfully accessed the related objects and can loop the array. I get the name of each object but cannot display the image. My code is:

{let vRelatedObjects=$node.object.related_contentobject_array}
{foreach $vRelatedObjects as $vMyObject}
name is: {$vMyObject.data_map.name.value}
image is: {content_view_gui content_object=$vMyObject.data_map.image}
{/foreach}
{/let}

Why doesn't the above display my image?

Regards,

Jason

Alexandre Abric

Wednesday 09 November 2005 5:39:14 am

Hi,

Try : {attribute_view_gui attribute=$vMyObject.data_map.image}

j jevack

Wednesday 09 November 2005 6:05:34 am

Greetings,

{attribute_view_gui attribute=$vMyObject.data_map.image} does not work either.

I guess i'm assuming that since i can access the related objects and display the name that I should be able to display the image. Is this incorrect?

Thanks,

Jason

Alexandre Abric

Wednesday 09 November 2005 6:21:54 am

have a look at :

{$vMyObject|attribute(show)}

If you can see the image attribute in the page, then the code above should work. If not, then you have to fetch the object, based on the node_id or the contentobject_id of $vMyObject.

j jevack

Wednesday 09 November 2005 7:16:25 am

{$vMyObject|attribute(show)} does provide the image attribute but {attribute_view_gui attribute=$vMyObject.image} provides no output.

I will try your sugestion to get the object id and then fetch that object.

Regards,

Jason

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