Forum

Thread tagged as: Error, Events

perch_events_event_categories() Not Working

Adding <?php perch_events_event_categories() ?> to my page is causing the following error:

Warning: Missing argument 1 for perch_events_event_categories(), called in /var/www/public/dpn.dev/events.php on line 18 and defined in /var/www/public/dpn.dev/dpn-admin/addons/apps/perch_events/runtime.php on line 124

Notice: Undefined variable: id_or_slug in /var/www/public/dpn.dev/dpn-admin/addons/apps/perch_events/runtime.php on line 126

The events are displaying correctly with perch_events_custom(). I haven't changed any event templates except for the one I'm using to display events. Diagnostics:

SUMMARY INFORMATION

Perch: 2.8.26, PHP: 5.6.14-1+deb.sury.org~trusty+1, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Linux, apache2handler
Installed apps: content (2.8.26), assets (2.8.26), categories (2.8.26), perch_blog (5.0), perch_events (1.9.2)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_events', );
PERCH_LOGINPATH: /dpn-admin
PERCH_PATH: /var/www/public/dpn.dev/dpn-admin
PERCH_CORE: /var/www/public/dpn.dev/dpn-admin/core
PERCH_RESFILEPATH: /var/www/public/dpn.dev/dpn-admin/resources
Image manipulation: GD Imagick
PHP limits: Max upload 100M, Max POST 100M, Memory: 128M, Total max file upload: 100M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: dpn.dev
DOCUMENT_ROOT: /var/www/public/dpn.dev
REQUEST_URI: /dpn-admin/core/settings/diagnostics/
SCRIPT_NAME: /dpn-admin/core/settings/diagnostics/index.php
Shane Lenzen

Shane Lenzen 18 points

  • 5 years ago

If anyone else has this probllem, got this working by using:

perch_events_categories(array(
  'template' => 'categories.html'
));

And in categories.html:

<li><a href="/events?cat=<perch:events id="categorySlug" />"><perch:events id="categoryTitle" /></a></li>

Also, any time I make changes to the category template, I also need to delete a file in /perch/resources that looks something like perch_blog.perch_events_categoriesaadd28983c5ee345bd71848b29dad9ff.cache, otherwise the changes don't show.

...aaand just leaving this here in case someone else needs it. If you're having problems with category caching, you can use 'cache' => false:

<?php perch_events_categories(array(
  'template' => 'categories.html',
  'cache' => false
)); ?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

As the name suggests, perch_events_event_categories() needs an event to return the categories for. The first argument should be an event identifier.

I must admit, I wasn't paying attention to function names as much as furiously searching the forum and docs for anything that resembled what I was after. :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Funny how that might lead to problems! ;)