Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hello everyone? I have tied myself in knots trying to sort this one out.

Basically, my client wants an event list with repeatable areas and a varying list of speakers. So, can anyone help acheive the following:

1) A speakers page with image, speagers name and biog. Does it need to be clonable/or nested etc.

2) An events page with repeatable regions (I've done this). But, I want to add a multi-selection dropdown with the speakers names from the speakers page into the repeatable admin area. So the clients selects the speakers and they show in the output – see below).

3) Display each event with all relevant speakers selected from the dropdown list.

Thanks in advance.

---------------------------------------------------------
Speakers page

Code: Select all
<cms:template title='Speakers' clonable='1' />

<cms:editable
    name='speakerimage'
    label='speaker Image'
    type='image'
    order='1'
    hidden='1'>
</cms:editable>

<cms:editable
    name='speakername'
    label='Speaker Name'
    type='text'
    order='1'
    hidden='1'>
</cms:editable>

<cms:editable
    name='speakerbio'
    label='Bpeaker Biography'
    type='richtext'
    order='2'
    hidden='1'>
</cms:editable>


---------------------------------------------------------
Events page

Code: Select all
<cms:template title='Events' />

<cms:repeatable name='events' label="Events" order='5' stacked_layout='1' >

<cms:editable
    name='eventtitle'
    label='Event Title'
    type='text'
    order='6'
    hidden='1'>
</cms:editable>

<cms:editable
    name='eventimage'
    label='Event Image'
    type='image'
    order='7'
    hidden='1'>
</cms:editable>

<cms:editable
    name='eventdescription'
    label='Event Description'
    type='richtext'
    order='8'
    hidden='1'>
</cms:editable>

-- This is where I would like the multi-selection dropdown

<cms:editable
    name='eventdates'
    label='Event Dates'
    type='richtext'
    order='12'
    hidden='1'>
</cms:editable>

</cms:repeatable>


----------------------------------------------------------------
Events Display – I've left out the formatting for clarity

Code: Select all
<cms:show eventtitle />
<cms:show_repeatable 'events' />
<cms:show eventimage />
<cms:show eventdescription />

-- Show all the selected speakers for this event

<cms:show eventdates />
</cms:show_repeatable>
markjeater wrote: Hello everyone? I have tied myself in knots trying to sort this one out.

I can imagine the juice :D
Try this very simple and powerful concept https://docs.couchcms.com/concepts/relationships.html
Also note this topic for times where the speakers list grows viewtopic.php?f=5&t=11021
I have read and re-read the documentation many times but cannot make head nor tail of it.

Like most documentation it seems to explain only 1 part of the solution!!!

All I am looking for is to display an EVENTS page of multiple events with selected speakers and their information drawn from the SPEAKERS clonable page.

IE:
1) The non-visible SPEAKER page has many speakers.

2) In the EVENTS admin I have a selection list.

3) The EVENTS page lists all the events with the selected speakers listed.

This means that on a page of 3 events each one lists only the selected speakers for that event.

Sounds simple!

Please can somebody reply with full code that links the pages (I can do the rest).

Thanks

Mark
Hi Mark,

@trendoman is right, relationships will be your friend here. Try something along these lines:

- - - - -

In your events.php template:
Code: Select all
<cms:editable
  name='speakers'
  label='Speakers'
  type='relation'
  has='many'
  masterpage='speakers.php'
  advanced_gui='1'
/>

You could also do has='one' if that suits you.

If you have a *large* list of speakers to choose from, I'd use advanced_gui='1', which will pop up a list to choose from similar to list view in admin panel (with pagination).

- - - - -

On your front end:
Code: Select all
<cms:pages masterpage='events.php'>

  // Event info available here

  <cms:related_pages 'speakers'>
 
    // Related speaker info available here

  </cms:related_pages>

</cms:pages>

- - - - -

And if it comes in handy, you can also do a reverse_related_pages loop from the speaker's point of view!

Code: Select all
<cms:pages masterpage='speakers.php'>

  // Speaker info available here

  <cms:reverse_related_pages masterpage='events.php' field='speakers'>

    // Event(s) this speaker is related to available here

  </cms:reverse_related_pages>

</cms:pages>

Relationships are very powerful. I encourage using them as often as possible to gain more understanding! :)

Hope that helps,
Matthew
4 posts Page 1 of 1
cron