Forum

Thread tagged as: Events

Want to style past events differently

Hi,

I am playing with perch_events and in the template for events-listing, I want to give past events a different style. Is there an attribute on an event that tells me it it has already passed?

How can I test with "<perch:if>" if PHP-functions (compare with "today") isn't available in the template-html?

Svein Are Gronsund

Svein Are Gronsund 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can compare the date of the event with the current date.

PerchSystem::set_var('current_date', date('Y-m-d H:i:s'));

and then

<perch:if id="eventDateTime" match="lt" value="{current_date}"> ... past event ... </perch:if>

Great. It worked :)