2

I am working on my first craft project and am wondering how to create the following data structure:

I have a page with a large archive of solo-events (lectures, discussions etc). I think I will use a channel with categories for this.

In addition, there is a second content type: a conference. A conference is a group of solo-events. For example, several lectures and discussions.

The conference as a container has certain fields (picture, text) and the solo-events have other fields (speakers for example).

I wonder what is the best way in Craft to enable this form of container.

Example:

Solo-Events:

  • Event 1 with Speaker a
  • Event 2 with Speaker b

Conferences:

  • Conference A

-- Event A1 with Speaker c

-- Event A2 with Speaker d

  • Conference B

-- Event B1 with Speaker e

-- Event B2 with Speaker f

In the Frontend I would like to have:

Speakers-Archive: I think this will be the easy one. For the speaker I would like to work with a channel and link them to the events.

Solo-Events and Conference-Archive:

A list with all solo-events and all conferences but without the sub-events. So, this list should contain: Event 1, Event 2, Conference A, Conference B (A1, A2, B1, B2 should be excluded)

I am wondering how to deal with this idea of grouping the events to conferences:

I was thinking:

  1. Two channels, events and conferences.

    All events (solo and conference-related) are in one channel. For a conference (second channel) I can select the events which I want to include. For the archive list I need to exclude all the solo-events that are part of conferences. This may not be optimal in terms of performance and user experience in the backend

  2. Structure for Confernces and a Channel for Solo-Events

    The conferences are the parent elements, the solo events are the child elements. But how can I create different fields for the parents and children?

  3. Structure with Entry Types:

    I wonder if i can work with entry type here as well. But But how can I bring the Entry Type together with the Hierarchy? So that Parent is always a conference and a children is an Event?

  4. Matrix Field:

    The Conferences has a matrix field to store the individual events. But I dont like this approach because I think it would be hard to get all the speaker from a conferences matrix field and combine them with the speaker from the solo-events to get one list with all speaker

  5. Categories.

    all events are stored in one channel and I create a Categorie for the Conferences. It feels kind of wrong-headed because the Conference (in my understanding) is the parent of the event rather than the category.

What do you think?

At the moment I am trying the second approach:

{# get all conferences (parents) (level =1 )  from a structure and merge with all solo-events from a channel#}

{% set entriesConferences = craft.entries.section('conferences').level(1).ids() %}
{% set entriesEvents = craft.entries.section(['events']).ids() %}

{# Combine those IDs #}
{% set entryIdsCombined = entriesConferences | merge(entriesEvents) %}

{# Get all entries (so, no IDs this time), using your IDs, order by date#}
{% set allEntries = craft.entries.id(entryIdsCombined).order('datumUhrzeit desc') %}

Is there a better (in terms of performance, scalability and user experience in the backend) way to archive this?

I asked this question Oli from the craft team and he gave me an answer that he will hopefully add here as well.

Thanks!

2

My approach:

  • Create one channel for events with different entry types (solo-events, conference-events)
  • Create one channel for conferences
  • Re-use the date fields in both channels
  • That way you can fetch and order events by the re-used date fields from both channels limiting to the entry types of solo-events and conferences with one query. That makes listings, filtering and paging easy.
  • Conference-events can be eager-loaded with the query as well
  • The entry type for conference-events has a mandatory entry field for the conference
  • In the control panel you can show the related conference by adding the field as a column in the overview
  • Speakers is another channel or structure being linked from within the conference-events

Why I would not use:

  • Matrix: can be easily queried but can not eager load the entry it belongs to
  • Category: feels wrong to always add categories for new conferences
  • Structures for events: Structure are not 100% user friendly when adding new entries, as they always need to be sorted manually (though there are some improvements in 3.7 coming up)
4
  • Thank you very much! I am testing your approach at the moment and I have a question about it: Is it possible to filter the entries in the backend by its entry type? At the moment i have one channel with all events (solo and conference-related), each has an entry type like you wrote. Now I will have a very long list of entries in the backend. How to just get the entries of one type? – buckdanny Apr 9 at 15:16
  • Or is it maybe better to work with two channels instead of one channel with two entry types? – buckdanny Apr 9 at 15:18
  • I don't think it's possible to filter by entrytype. in this case, 2 channels are better. – Matthias Redl-Mann Apr 9 at 16:15
  • thanks for your quick help! – buckdanny Apr 9 at 16: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.