0

I am building a site for a school. The school has classes and the school has events. Some of the events are school-wide and some are specific to a certain class. On a class detail page (domain.com/classes/class-name) I want to make a list of upcoming events that comingles events that are specific to that class as well as school-wide events.

The natural thought was to use relationships to do this. However, I am using icons to represent which class an event is related to and I want to have one icon for school-wide events (rather than showing 10 different icons for every related class).

So instead I am using categories. I have made a category for each class and am sharing the category group across both the event and class channels. I would love to be able to create a variable in the class channel loop and pass it to the parameters in the events loop. It would look something like this:

{exp:channel:entries channel="classes" limit="1"}
  {cat_var="{category_id}"}
{/exp:channel:entries}

{exp:low_events:entries channel="events" category="{cat_var}"}
  <li>{title}</li>
{/exp:low_events:entries}

I feel like there used to be a way to do this in EE 1.x. Doesn't seem to be there any more though. I also realize that this may be a totally dumb way to try to solve this problem, but it is the best I can come up with right now.

Anyone have any tips I how I might make this happen, or suggestions on another way to thing about it?

As always, any help is appreciated.

Thanks!

1

I don't know if this will be helpful to anyone else, but I solved my problem. Basically, I went back to thinking of this as something best handled by relationships rather than categories. I realized that if I use Playa instead of EE's native relationships my client could just check off all of the classes that an event is related to. That makes listing related events on the class detail page.

Then, because playa has the {exp:playa:total_children} tag, I could do this on the event listings:

{if "{exp:playa:total_children}" >= "10"}
  <li>All Classes</li>
{if:else}
  {exp:playa:children field="related"}
    <li>{title}</li>
  {/exp:playa:children}
{/if}

Reading "All Classes" is a much better user experience than having to read a list of 10 things to decide whether this event applies to you.

Anyway, I am not sure I did a great job of explaining this problem or my solution, but maybe something in here helps someone somewhere eventually.

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.