0

I have set an extended set of segments based on playa parent/child relationships

http://example.com/template-group/template/playa-parent/playa-child

I would like retrieve the content of an entry based on segment 4 but

  1. I'm not sure I can do this and
  2. I'm not sure if what I am doing is right?
{exp:channel:entries channel="countries" dynamic="yes" limit="1"}
{exp:playa:parent dynamic="yes" limit="1" channel="cities"}
{title}
{/exp:playa:parent}
{/exp:channel:entries}

I expect cities to yield the entries title ("London") based on the following URL

http://example.com/template-group/template/england/london

[EDITED: Typo fixed for limit syntax]

1

Answering my own question in case others have a similar issue.

I reverted to only using the {exp:channel:entries} tag with the url_title peremeter set to {last_segment} like this

{exp:channel:entries
    channel="cities"
    dynamic="no"
    url_title="{last_segment}"
}

Simple.

| improve this answer | |
0

Not sure if it's a typo, but the first thing I noticed was your limit parameter is a minus, not an equal symbol to equal the value 1 on the channel entry pair tag. Countries are the parent as stated, so wouldn't you want to use?

{exp:channel:entries channel="countries" dynamic="yes" limit="1"} {exp:playa:children field="[your_country_field_relationship_to_city_entry]"} {title} {/exp:playa:children} {/exp:channel:entries}

P.S. With the exp:playa:children you can pretty much use any parameter the channel entries tag has available. So even a url_title parameter with segment_4 might work in this case.

| improve this answer | |
  • Each City channel entry is attached to a Country channel entry via the playa field {country}. I would have thought at to use the Playa Children tag I would then have to attach every city to the countries channel entry? The {exp:playa:children} tag returns no entries. – Bryan Hickey Sep 25 '14 at 7:11
  • So you want a city to belong to multiple countries? – Bransin Sep 26 '14 at 17:23
  • Have you tried removing the dynamic yes parameter from the playa:parent tag? Also, have you tried ditching the field parameter and just use the channel parameter? – Bransin Sep 27 '14 at 18:07
  • The city belongs to only one country as only one entry can selected with the playa field. – Bryan Hickey Sep 27 '14 at 21:05
  • Thanks for the response. I have tried both these options with no success. The field parameter has no affect on a playa parent tag. The channel parameter applied to a playa parent tag yields only the first entry regardless of what property is applied to the dynamic parameter. I want it to display the same entry as shown in segment 4. – Bryan Hickey Sep 27 '14 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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