Forums / Setup & design / [solved] Can't get URL of reverse_ related_ objects

[solved] Can't get URL of reverse_ related_ objects

Author Message

Nathan Kelly

Tuesday 13 September 2005 6:34:18 pm

Hi there,

I'm having some difficulty accessing the URL of my (RRO). I can access the name of the object and if I use the {$node|attribute(show)} function I can see that the URL's are there but for some reason I can't get them into my <a> tag.

I am able to get the name as I said using a simple {$node.name|wash} function and I am trying to retrieve the URL with the usual {$node.url_alias|ezurl} but with no success, all I get is a link to the root node eg:

[http]://www[DOT]example[DOT]com/site_name).

If I remove the |ezurl parameter I get the path of the node I am currently on.

Can anybody suggest any ideas on how I can access this elusive URL?

Cheers!

Pardon me while I burst into flames...

Nathan Kelly

Tuesday 13 September 2005 8:17:20 pm

[solved]

Finaly after 2 full days of trying I found the solution, the simple things in Ez seem to be the hardest to figure out... <i>(Ez is not that easy and it is costing me alot of time and money)</i>

Solution: {$node.main_node.url_alias|ezurl}

Cheers!

Pardon me while I burst into flames...

Kristof Coomans

Tuesday 13 September 2005 11:26:07 pm

As the name says, the template fetch function reverse_related_objects of the content module returns an array of ezcontentobject objects. An object has no URL alias, but a node has one. That's why you need to get the main node of the object first.

To keep your code easy to understand, I advice you to replace the variable name $node with $relatedObject.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Nathan Kelly

Wednesday 14 September 2005 12:56:07 am

<i>To keep your code easy to understand, I advice you to replace the variable name $node with $relatedObject.</i>

My actual code uses the variable $product rather than $node as $product is the only related object within the system, I'm not using object relations for anything else at this stage, I just used $node as the example for forum readers.

I actually stumbled upon the main_node parameter by fortune, I had not seen it until now, but it's all fixed and working now so all is good!

PS I'm starting to understand the Ez syntax more each day, but as I stated in the previous post the time it takes to figure out simple problems is a major pain.

I honestly believe Ez Systems should set up a (proper) wiki so that experienced users can share their knowledge in an easy to digest format. It would certainly cut down on the amount of posts that relate to very similar problems and simple issues like this would not need to be raised in the forum because the main_node parameter would be outlined/documented within the wiki.

I for one would contribute my knowledge when I acquire enough of it...

[EDIT]
Just to add to that... Thousands of simple problems have been answered in these forums, yet people still have no choice but to ask the question again. The reason for this is clear, either people are asking the wrong questions or people searching for answers are looking for the wrong questions...

Apart from that, I am on this forum for 9 hours a day (Australian EST) and in that time I may see that only one post has been made or answered, If there was a wiki that could answer all of these <b>little</b> questions then people wouldn't have to wait 12 odd hours for some clue of what they need to do.

Sorry I'm strolling off topic here but I'm just trying to illustrate a need for the community to have more control of the documentation process, there are a lot of very talented people here with useful information but it's very hard to find in its current form!
[/EDIT]

Cheers!

Pardon me while I burst into flames...

Gabriel Ambuehl

Wednesday 14 September 2005 3:57:07 am

A ezpublish integrated wiki is in development ;)

It'll be up to ez to integrate it into ez.no, if they don't, I'll host it myself.

Visit http://triligon.org

Nathan Kelly

Wednesday 14 September 2005 4:32:12 pm

That's very welcome news Gabriel, I look forward to its release!

Cheers!

Pardon me while I burst into flames...