Forums / Developer / Related Object URL

Related Object URL

Author Message

David Jones

Monday 21 August 2006 6:49:05 am

I want to create a link to a related object.

This is my code

{let related_objects=fetch( 'content', 'related_objects',
	hash( 'object_id', $module_result.content_info.object_id ) )}
				   
	      {section loop=$related_objects var=related_object}
				  		
		    {if eq($related_object.content_class.identifier, "text_page" )}
			<a href={$related_object.url_alias|ezurl()}>{$related_object.data_map.page_title.content|wash}</a><br />
		     {/if}
		{/section}

The link displays with the correct page title but the URL is incomplete. It simply links to the rout of the site..

I assume that this

$related_object.url_alias|ezurl()

Doesn't pull out the objects URL.

What does?

Thanks

Damien Pobel

Monday 21 August 2006 7:18:27 am

$related_object is an ezcontentobject [1], to get his URL you need an ezcontentobjecttreenode [2]. It should work with :

$related_object.main_node.url_alias|ezurl()

[1] http://ez.no/doc/ez_publish/technical_manual/3_8/reference/objects/ezcontentobject
[2] http://ez.no/doc/ez_publish/technical_manual/3_8/reference/objects/ezcontentobjecttreenode

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

David Jones

Monday 21 August 2006 8:09:30 am

thanks, that worked great.