Forum

Thread tagged as: Question, Events

Use events in other template and events with multiple filters

  1. I'm creating a news page. It will be set up as a two-page list and detail pages. Inside the news detail template I would also like to access content from Events. Basically I'd like to somehow combine both perch_events_custom and perch_content_custom and send to the same template.

  2. Is it possible to filter by multiple values with perch_events_custom? I tried this before in Events 1.9 and it didn't work. Has this been fixed since then?

perch_events_custom (array(
             'template' => 'events/listing/custom-listing-day-grid.html',
             'sort'=>'eventDateTime',
             'sort-order'=>'ASC',
             'filter' => array (
                array (
                    'filter' => 'eventDateTime',
                    'match' => 'gte',
                    'value' => date('Y-m-d'),
                    ),
                   array (
                    'filter' => 'publish_on',
                    'match' => 'lte',
                    'value' => date('Y-m-d'),
                    ),
             )
            ));
Tim Kinali

Tim Kinali 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you give an example of what you're trying to achieve?

  1. I'm trying to achieve a way for my client to manage their newsletters from Perch. The list/detail pages works as an online archive of the newsletters. And if the admin is logged in, the newsletter page returns html code with auto-inlined css for them to copy-paste in their email software.

Using a list / detail page setup, the editor creates a newsletter. In addition to regular news each newsletter will contain: * Featured upcoming events: With photo + detailed information. Optimally the editor would be able to pick exactly which events they want to feature from the complete list of events. Have not figured out how to do it! Worst case it will just be a option like "Number of featured events to show" (1,2,3,4,5) and it would just pull the next 5 events for example. * Event list Short listing with title and dates. Editor can choose how many events to include.

2. The editor wants to be able to create an event without publishing it. There is no "save as draft" in Events. So I added a "Publish on date" date selector to the events template. Then I would like to use that as a filter together with eventDateTime, as seen in my example code above.

Drew McLellan

Drew McLellan 2638 points
Perch Support

  1. I can't think of a way to do that with the Events app.

  2. You can only currently filter by the fixed fields - Events predates the ability to filter by multiple fields and custom fields.

Hi Tim,

Could you use Events Categories? It would be a little bit of a workaround but you could use a keyword for the article that is also then set as an event category name or slug. You apply the category to whichever events and then pull them in an output template.

Robert, yes that would be an OK workaround for now. I'll create a "featured" category and in the newsletter template I give the editor a few display options that I'll pass along as query-strings to the page. I've got everything working now it seems.

For 2) I guess I would have to resort to do 'skip-template' or 'split-items' and then filter the array manually on the pub_date field. Optionally I'll use categories here as well, I could have a 'hidden' category and do 'category' => '!hidden' . But then the editor can't use it to queue events for automatic publishing.

It's unfortunate that the Events app is old and a bit neglected...

I completely agree with you Tim. Events isn't Blog but it could at least be updated in line with other apps.