2

There are several portions of my site that rely upon self referencing relationships, that are (or rather were) gathered through the reverse_related_entries tag pair.

Quick example:

I have a channel for press releases. One of the attributes of that channel is a relationship called translations, which points to its own channel, press releases.

When a PR is entered it is usually in English only. Often though, there will be other translations of that same PR, so when they go into the system, the relationship attribute is used to “point” to the origin press release. Then in a template where the origin press release is being shown, I used a reverse_related_entries pair to loop through and show me all the other language press releases that pointed to “this” one.

Well, I’ve just upgraded to 2.6.x from 2.5.x and all my templates which used relationships in any way are now broken, because there is no backwards compatibility here. Sucks big time, but what can ya do…

The problem is, as sexy as the re-designed relationship functionality looks to be at first glance, I cannot for the life of me figure out how to reproduce what I was doing before. Everything seems to rely on being inside of a exp:channel:entries call where the channel in question has clear relationships downward to children. It’s a bit confusing.

Given the scenario I’ve described above, is there anybody alive who can tell me how to duplicate the reverse_related_entries functionality in the new format?

I’m truly desperate here and any help is hugely appreciated.

Andy

1 Answer 1

3

I think the {parents} tag is what you're looking for. Where other articles are essentially "pointing" to this one, you should be able to do something like:

<h2>Also available in:</h2>
<ul>
{parents field="original_article_relationship_field_name"}
    <li><a href="{parents:url_title}">{parents:language}</a></li>
{/parents}
</ul>

The nearest example in the EE documentation is The Pizza Shop

3
  • 1
    This is embarrassing. I swear up and down I tried exactly that, several times in fact, and it was always a bust. But lo and behold, taking another run at it and darned if it doesn't work sweet as you please. Very, very grateful for the help!
    – Andy
    Aug 20, 2013 at 12:12
  • Dave, thanks again for the tip, really appreciated. I'm now having an odd problem that I can't explain and I'm curious, are there any debugging tools specifically for the new relationship syntax? I can't get a simple relationship to display {rel_tagname}{rel_tagname:title}{/rel_tagname} simply will not produce a result, on a whole "family" of attributes. I have a channel field group with 2 relationships in it. The one will render a result perfectly, the other doesn't respond at all. I can guarantee spellings are correct, and content is present. If I add a 3rd relationship, it also works.
    – Andy
    Aug 21, 2013 at 8:36
  • Hmm, think I just found an answer here: expressionengine.stackexchange.com/questions/10320/… Odd, though. Why does it sometimes work anyway with the surrounding tag-pair, even though there is only a single entry? Seems pretty inconsistent.
    – Andy
    Aug 21, 2013 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.