0

I have a Playa field that contains related People to display on a page. In each Person entry there is a standard EE Relationship field (pre EE2.6) to assign the Office Location.

What I need to do is show the telephone number from the Office Location, but can't figure out the best way to do it.

Here is my code;

{exp:playa:children field="page_people"}
    {exp:stash:append_list name="page_people" parse_tags="yes"}
        {stash:person_title}{title}{/stash:person_title}
        {!--This is the relationship field for Telephone--}
        {stash:person_telephone}{related_entries id='person_office'}{location_telephone}{/related_entries}{/stash:person_telephone}
    {/exp:stash:append_list}
{/exp:playa:children}

When the page renders, it just displays as {REL[person_office]6g2JK3WuREL}.

If anyone can offer a suggestion, I would be grateful.

Thanks.

1 Answer 1

-1

The {related_entries} tag was used in EE1, but is no longer used in EE2.

Instead, to call in data from a native EE2 relationship field, you need to use a looping tag pair. For example:

{your_relationship_field}
    {your_relationship_field:title}
    {your_relationship_field:a_custom_field}
{/your_relationship_field}

If your relationship field only accepts one single entry, you can also just use a single tag without the loop, like so:

{your_relationship_field:a_custom_field}

You can find more detailed examples in the EE documentation documentation.

So, your code {related_entries id='person_office'}{location_telephone}{/related_entries} should be:

{person_office:location_telephone}
4
  • Thanks Katrin. Unfortunately that syntax is for EE version 2.6+. I'm only on EE 2.5.4. Commented Jan 31, 2014 at 11:58
  • My mistake, sorry. Should have read your questions properly. Have you tried adding {exp:playa:children field="page_people"} {related_entries id='person_office'}{location_telephone} {/related_entries} {/exp:playa:children} within a channel loop to your output/view template directly? Does it return the correct value then?
    – Katrin
    Commented Jan 31, 2014 at 12:11
  • Hi Katrin, no it just returns the {REL[person_office]6g2JK3WuREL} code. Commented Jan 31, 2014 at 12:15
  • Does template debugging shed any light?
    – Katrin
    Commented Jan 31, 2014 at 12:36

Your Answer

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

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