Forums / Setup & design / How to fetch the data inside a 'reverse object'?

How to fetch the data inside a 'reverse object'?

Author Message

Sam Wong

Friday 25 November 2005 6:23:21 am

Here's my problem...

{def $objects=fetch( 'content', 'reverse_related_objects', hash( object_id, $node.contentobject_id, attribute_identifier, 207 ) )}

{foreach $objects as $obj}
		{content_view_gui view=text_linked content_object=$obj}
{/foreach}

I tried to display most of content (author, title, intro, links) from a list of reverse objects without any success. I only got the code to display both links and topic. However, I'm so lost as to which code I have to use to retrieve the data inside. I couldn't find any useful examples to help me with that.

My 'article' class:
- title
- intro
- body
- image
- enable_comments

Any help is appreciated.

Sam Wong

Saturday 26 November 2005 7:41:07 am

Could anyone PLEASE provide any pointers? I'm begging you... :(

I'm totally lost as to how I can retrieve data. I searched everywhere in the documentation, and tried literally every example I could find from the templates. Unfortunately, I still couldn't display any attributes (author, title, intro) from my reverse objects.

Xavier Dutoit

Saturday 26 November 2005 8:05:35 am

In your foreach, put a {$obj|attribute(show,2)}, you'll find all the attributes you want.

X+

http://www.sydesy.com

Sam Wong

Saturday 26 November 2005 8:58:21 am

Thanks Xavier Dutoit. I found out about this code, but still couldn't display anything.

The worst part is I don't know where to start.

I'm pretty serious :( when I say ya i looked everywhere. Tried everything. None worked. I have some experience in OOP, but the syntax for the system is killing me.

I tried the following:
attribute_view_gui...
$obj.object.data_map.intro
$obj.object.intro
$obj.object.data_map.intro.content

and a bunch of other codes too. Sigh... sorry for the whining.

Sam Wong

Saturday 26 November 2005 11:00:55 am

Just want to say thanks. I finally got it to work.

<a href="{$obj.main_node.url_alias}"><big>{$obj.name}</big></a>
<br /><small>Posted on {$obj.published|l10n( 'date' )}
by {$obj.current.creator.name}</small>
<p />{$obj.contentobject_attributes.3.data_text}

Basically, it's relatively easy now that I figured out the structure.