1

To set the stage, I've got 3 Channels: Agenda, Sessions, and Speakers, with a breakdown of the custom field types as follows.

  • Agenda contains a Matrix field with 3 columns - the start time, end time, and a Playa field to select the session to add to the time slot
  • Sessions contains a title and description field along with a Playa field to choose the Speaker(s) for that session
  • Speaker contains several custom fields that describe the speaker.

I'm trying to create the Agenda, and read about a few different options. This is what I have so far, but obviously it's not working.

{exp:channel:entries channel="agenda" dynamic="no" limit="1" show_future_entries="yes" }
<h1>{title}</h1>
{agenda_description}
<h3>{agenda_date_monday format="%l, %F %j"}</h3>
{agenda_monday}
<div class="details_left">{am_start_time format="%g:%i%a"} - {am_end_time format="%g:%i%a"}</div>
<div class="details_right">
    {am_session}<h4><a href="{path={channel_short_name}/{url_title}}">{title}</a></h4>
        {session_speakers}
          <p>{title}</p>
        {/session_speakers}
    {/am_session}
</div>
{/agenda_monday}
{/exp:channel:entries}

Thanks for any suggestions, and please feel free to ask clarifying questions!

1 Answer 1

1

As per the Playa docs on nested relationships:

If you need to access a Playa field from within another Playa field, the only way to go about that is through an embedded template:

So in your case:

{exp:channel:entries channel="agenda" dynamic="no" limit="1" show_future_entries="yes" }
    <h1>{title}</h1>
    {agenda_description}
    <h3>{agenda_date_monday format="%l, %F %j"}</h3>
    {agenda_monday}
        <div class="details_left">{am_start_time format="%g:%i%a"} - {am_end_time format="%g:%i%a"}</div>
        <div class="details_right">
            {embed="agenda/_session_listing" entry_ids="{am_session:child_ids}"}
        </div>
    {/agenda_monday}
{/exp:channel:entries}

Then in agenda/_session_listing:

{exp:channel:entries channel="sessions" fixed_order="0|{embed:entry_ids}" dynamic="no" disable=member_data|pagination|categories"}
    <h4><a href="{path={channel_short_name}/{url_title}}">{title}</a></h4>
    {session_speakers}
        <p>{title}</p>
    {/session_speakers}
{/exp:channel:entries}

Another tip: instead of using {path={channel_short_name}/{url_title}}, consider using {comment_url_title_auto_path} (docs).

1
  • Awesome - thanks Derek. I saw the documents on nested relationships, and was playing with an embed, but couldn't quite get it right. Your example was perfect!
    – Todd
    Apr 1, 2013 at 15:02

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.