Forums / Setup & design / Fetching the object in an ezobjectrelation

Fetching the object in an ezobjectrelation

Author Message

Jason Filby

Wednesday 28 January 2004 10:19:15 am

Hi all

I posted a message on this a short time back, but never got it working. I need to fetch the object contained in an ezobjectrelation, so that I can obtain specific attributes in that object. I don't think that it works at all like an ezobjectrelationlist.

Thanks
Jason

James Packham

Thursday 29 January 2004 1:56:08 am

Forget about the database.

Fetch the object and then use it's attributes in your code, not the other way around.

Regards,

James

Jason Filby

Thursday 29 January 2004 3:13:52 am

Hi James

Fetching the object and refering to its attributes is exactly what I want to do. But how exactly do I do this?

Thanks
Jason

James Packham

Thursday 29 January 2004 5:49:03 am

I think this might help you:

In your template write {$object_you_just_fetched|attribute(show)}

Will show you all the attributes available for that object, for example if you saw something like

data_map array
>name string

then your object would have attributes called data_map (an array) and name (a string inside data_map)

so you could call name with:

{$your_object_name.data_map.name}

see http://www.ez.no/ez_publish/documentation/customization/custom_design/template_variables_set_by_ezpublish there's more documentation on this as well, I'd scan through the "building an ezpublish site tutorial"

Regards.

~James~

Jason Filby

Thursday 29 January 2004 6:28:16 am

Hi James

Yes, I know about that part of it. My question is how exactly do you fetch that object? I'm working with an object that has content.data_map.my_relation_object (for example). How do I fetch the actual object in my_relation_object?

Thanks
Jason

Jason Filby

Wednesday 04 February 2004 10:22:47 am

Thanks for the help James. The final result - for anyone interested - can be found here:
http://ez.no/community/forum/setup_design/fetching_an_object_using_contentobject_id

Cheers
Jason