1

I'm an EE novice working on a big site. I have a configuration concept in my head and I want to know if it's doable. Please bear with my limited knowledge of EE lingo. I'm still learning.

So I have a channel Speaker whose channel fields include Name, Topic, Bio, etc. I have another channel Multimedia which includes many of the same kinds of channel fields: Title, Subtitle, Description, etc.

We have speakers come in regularly and give a presentation. We create their Speaker entry long before their event. After the event we produce a video and create the Multimedia entry for that event. We do multimedia for other types of events which is why we don't just have a multimedia channel field in the Speaker channel.

Is there a way for me to add a Playa channel field to Multimedia, connecting a Multimedia entry to a Speaker entry, and then populate the template with Speaker info?

Something like this (this is again, theoretical, but if you feel the need to correct my syntax, go right ahead):

{exp:channel:entries channel="Multimedia"}
  {if playa_field}
    {playa_field}
      <h1>{speaker_name}</h1>
      <h2>{speaker_topic}</h2>
      <p>{speaker_bio}</p>
    {/playa_field}
  {if:else}
    <h1>{media_title}</h1>
    <h2>{media_subtitle}</h2>
    <p>{media_desc}</p>
  {/if}
  <video src="{media_url}">Your browser doesn't support HTML5 video.</video>
{/exp:channel:entries}

(edit: removed a redundant {/if} thanks to syntax correction in comments)

1

You have it exactly right, save one syntax error - after {/playa_field}, you should go right to {if:else}, skipping the {/if}.

| improve this answer | |
  • I can't believe I got it exactly right. I just tried it and it works! Okay so next step... can I store all those Speaker channel field values for use elsewhere in the template? Like maybe... {playa_field speaker_name="{speaker_name}" speaker_topic="{speaker_topic}" speaker_bio="{speaker_bio}" } {/playa_field} – Daniel Fowler Sep 4 '13 at 21:40
  • Hmm, not sure what you want to do there. Fieldtype tags are for getting data, not setting data. Can you elaborate? – Derek Hogue Sep 4 '13 at 21:47
  • Nevermind. It's not a big hassle to make more than one IF statement. – Daniel Fowler Sep 10 '13 at 18:16

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.