Forum

Thread tagged as: Configuration, Addons, Events

Better documentation for Events list/detail template setup

It would be great if someone could give a brief outline of the process that they used to get a simple list of upcoming events that link to a detail page for that one specific event. This seems to be the most basic need for the Events app, but one that is very poorly documented on the support site.

In the listing I just want the date and event name as a link to a page containing the detailed info. The example files in the events app don't provide a working example of this.

Timothy Swan

Timothy Swan 0 points

  • 7 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

There is a working example of this in the example files. (I've just downloaded the app to make sure it didn't go missing in the last build or something)

If you explain why that isn't working for you then we might be able to help.

I expected the events-custom.php page would be set up to work this way, but when I view that I get the full listing and not a list of events.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Have you set the path to your event detail page under Settings in Perch?

The listing pages use a template that has a link to the detail page (event.php in the example files)

Yes, I have my event detail page listed under the Settings.

I've discovered that if I remove the line for 'filter'=>'eventSlug', then all of my entries will display. If I have that in my "event.php" file, then no entries are displayed.

The code in my event.php file is:

                perch_events_custom(array(
                    'filter'=>'eventSlug',
                    'match'=>'eq',
                    'value'=>perch_get('s'),
                    'template'=>'listing/event-detail.html'
                ));

and within my event detail page:

<div class="vevent">
    <h2 class="summary"><perch:events id="eventTitle" /></h2>
    <p class="dtstart"><span class="value-title" title="<perch:events id="eventDateTime" format="c" />"></span> - <perch:events id="eventDateTimeEnd" type="time" label="End time" format="%c" /></p>
    <div class="description"><perch:events id="eventDescHTML" type="textarea" editor="ckeditor" html="true" encode="false" /></div>
    <p><perch:events id="trip_full" type="checkbox" label="Trip full" value="Full" /></p>
    <p class="category"><perch:events id="category_names" encode="false" /></p>
    <perch:if exists="image"><img src="<perch:events id="image" type="image" label="Image" width="400" crop="true" />" alt="<perch:events id="eventTitle" />" /></perch:if>
</div>

Is the "eventSlug" field created automatically by the Events app?

Drew McLellan

Drew McLellan 2638 points
Perch Support

What URL do you have for an event detail page?

Timothy,

I have a rough guide in a document that I was planning to turn in to a blog post, once I get my new site up, as I have been using both the news and events module recently, Let me know if you want me to share.

Thanks

Lee

You could try:

'filter' => 'eventSlug', 'match' => 'eq', 'value' => $_GET['event'],

Regards

Lee

Thanks Lee, that worked great!

Thanks Lee,

I was also having problems clicking through from my listings page to the event page. So I checked the example pages and they also did not work for me either?

Clicking through to a listed event took me to an empty event page

So in the events.php file I replaced 'value'


<?php perch_events_custom(array( 'filter'=>'eventSlug', 'match'=>'eq', 'value'=>perch_get('s'), 'template'=>'listing/event-detail.html' )); ?>

with 'value' => $_GET['event'], as suggested and now it's working fine.


<?php perch_events_custom(array( 'filter'=>'eventSlug', 'match'=>'eq', 'value' => $_GET['event'], 'template'=>'listing/event-detail.html' )); ?>
Abby Larsen

Abby Larsen 0 points
Registered Developer

I had this same issue with the example pages, no data displayed on the detail page. The solution put forth by Lee Goodman and Andy Clark —

'value'=>perch_get('s') replaced with 'value' => $_GET['event']

— worked for me, too.

I have a freshly downloaded and installed (never installed before) copy of the Events app (1.9) and a freshly upgraded Perch 2.6.6.

I experienced this behavior in a test site running on MAMP.

Richard Lowe

Richard Lowe 0 points
Registered Developer

Thank you so much, Lee and Andy, I've been pulling what's left of my hair out over this for a day. This solution worked for me too!