Forum

Thread tagged as: Discussion

Events Templates -- Which ones control edit fields?

I'll try to formulate more specific questions after I can test editing different templates when copying the events templates from perch/addons/apps/perch_events/templates to perch/templates/events, but first, a couple questions:

  • Which of the events templates controls the fields that appear for editing? I added a custom field by editing event-day.html, but I also added the same field to listing/custom-listing-day.html
  • When one template is specifically used through the perch_events_custom field, does that affect the fields that are available in the editor? In order to get around my confusion over what markup was coming from what template, I made a custom template that I passed through perch_events_custom, but now not all of the entries have the custom field, and the field doesn't appear in the editor anymore. Maybe I'm confused about the reason the field disappeared. The original edited templates are still there. The markup for the custom field still appears for all but one of the entries. I think the reason the markup disappeared for one entry is that I saved it in the editor after the field was no longer appearing there.

I think I'll have more success editing copies of the original templates than using perch_events_custom, but I don't know what templates do what.

Paul Lee

Paul Lee 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

The Master Template is event.html. If you enable debug you can see which template is in use at any point howewer this is also detailed in the documentation https://docs.grabaperch.com/addons/events/template-tags/

Do not edit these templates directly, you need to copy them into your templates folder as explained on that page.

Any template you pass in with a custom function can only use fields specified in the Master Template, it won't introduce new ones to admin. This is the same for everything in Perch.

Rachel Andrew said:

The Master Template is event.html. If you enable debug you can see which template is in use at any point howewer this is also detailed in the documentation https://docs.grabaperch.com/addons/events/template-tags/

That's very helpful---I've made progress---but I still can't source some of the markup.

The debug output shows three templates related to events:

Using template: \addons\apps\perch_events\templates\events\listing\calendar.html
Using template: \templates\events\listing\event-day.html
Using template: \templates\events\listing\blank-day.html

event-day.html only includes a <li> element, not the parent <ul class="calendar"> element. When I copy my markup -- which contains the <ul> element with an additional class added to it -- over the copy of that file in the templates folder, it repeats the <ul> for each event, and there is still a parent <ul class="calendar">.

Looking at the default calendar.html, it doesn't seem possible that the <ul> element is coming from there, so I didn't make a modified version of that file.

(I don't see the parent <ul> in event.html, either....)

Drew McLellan

Drew McLellan 2638 points
Perch Support

events\listing\calendar.html contains the <ul class="calendar">.