Forum

Thread tagged as: Problem, Configuration, Events

Retrieving event field back into event-day template

I've created this is category.html so you can select a colour in the Events app > Edit > Caterogies. The aim to add a class to each event category.

<perch:events id="col" type="select" label="Select Colour" options="Green, Blue, Grey, Pink, Brown, Orange, Yellow, Purple" allowempty="true" /> help="Select a colour for this category"/>

So good so far

I put t this in <perch:events id="col" /> in event-day.html and nothing is returned for the id="col" Heres the template...

<perch:before>
    <div class="eventwrap">
    <span class="day"><perch:events id="eventDateTime" format="j" /></span>
</perch:before>

<div class="vevent event <perch:events id="category_slugs" /> <perch:events id="col" />">
    <a href="<perch:events id="eventURL" />"><span class="time dtstart"><span class="value-title" title="<perch:events id="eventDateTime" format="c" />"><perch:events id="eventDateTime" format="%l:%M%p" /></span> </span>
    <span class="summary"><perch:events id="eventTitle" /></span>
    </a>
</div>
<perch:after></div></perch:after>

Where am I going wrong?

David Owen

David Owen 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Don't forget the type attribute.

I'm not sure what you mean, the input id="col" already has type="select"...

<perch:events id="col" type="select" label="Select Colour" options="Green, Blue, Grey, Pink, Brown, Orange, Yellow, Purple" allowempty="true" /> help="Select a colour for this category"/>

I did a <perch:showall /> and the input field id="col" is not available to the output template event-day.html so I'm puzzled what's going wrong.

Can I add extra fields to the events app?

Drew McLellan

Drew McLellan 2638 points
Perch Support

In event-day.html you have this:

<perch:events id="col" />

That's missing a type attribute.

<perch:events id="col" type="select" />

Also this is malformed:

<perch:events id="col" type="select" label="Select Colour" options="Green, Blue, Grey, Pink, Brown, Orange, Yellow, Purple" allowempty="true" /> help="Select a colour for this category"/>

Should be:

<perch:events id="col" type="select" label="Select Colour" options="Green, Blue, Grey, Pink, Brown, Orange, Yellow, Purple" allowempty="true" help="Select a colour for this category" />

Ops! Corrected those however <perch:events id="col" type="select" /> still does not appear in the output for event-day.html

Adding <perch:showall /> to the event-day.html template says id="col" is not available to use???

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's probably the answer then - if it's not available it may not be being exposed to the template.

Is this id missing because I'm using an event "category" template an output in the event "day" template two different areas of the events app?

For example <perch:showall /> does say it's available to the category_link.html template

How do you (can you) expose ids to another templates?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Right, at a guess the category information isn't passed into the calendar like that.

You can use PerchSystem::set_var() to pass content into templates, but the calendar is a strange beast and I'm not sure that would really work here.