Events categories links
Is there any way to create a dynamic list of "category links" for each of categories assigned to an event on it's detail page?
Only fields available from the event detail page are {category_slugs} and {category_names}... is there another way get this information?
Below works if a single category is selected, breaks when an event belongs to multiple categories (obviously)
<a href="category.php?cat=<perch:events id="category_slugs" />"><perch:events id="category_names" /></a>
You can also use
perch_events_event_categories()
I guess that is something that I'm still not understanding how to do properly.
perch_events_event_categories()
needs to be added to my event.php page, or is there a another way to retrieve that information directly into my event-detail.html template?You can pass the result into the template using
PerchSystem::set_var()
https://docs.grabaperch.com/docs/templates/passing-variables-into-templates/
Something like this?
Not sure how to retrieve all assigned categories and their slugs and then reassemble in my template.
Yes, just be sure to pass your arguments to
perch_events_event_categories()
I apologize, not my strong suit.
Tried grabbing info from my event.html template, but when I do a showall, I only see the categories in the ID column and values of "true" assigned to them:
sports-recreation true town-services true
I'm looking for the event's separate categorySlug(s) & categoryTitle(s), where do they reside or what is the argument to pass to get them?
Is the event slug on the URL?
Yes.
/events/event.php?s=2016-01-08-senior-mixed-curling-championship
Ok, so you'd use something like:
Still not working. Now the page loads blank. Path to template is correct and in place.
Did I add the code to the wrong place? Should it be down in the if (perch_get('s')) section?
Doesn't seem to be finding anything:
Array ( [perch_page_path] => /events/event.php [eventEnd] => 2016-01-08 09:00:00 [eventCategories] => )
Are you getting your event back?
Yes, I'm getting it back.
Also not sure if this helps, I'm a set to development mode and haven't modified anything relating to Perch or the events app.
Perch: 2.8.20, PHP: 5.6.16, MySQL: 5.6.26, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (2.8.20), assets (2.8.20), categories (2.8.20), perch_events (1.9.2), perch_backup (1.2) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_events' ); PERCH_LOGINPATH: /perch PERCH_PATH: /home/norfolkct/public_html/perch PERCH_CORE: /home/norfolkct/public_html/perch/core PERCH_RESFILEPATH: /home/norfolkct/public_html/perch/resources Image manipulation: GD Imagick PHP limits: Max upload 16M, Max POST 32M, Memory: 256M, Total max file upload: 16M Resource folder writeable: Yes DOCUMENT_ROOT: /home/norfolkct/public_html HTTP_HOST: norfolkct.org REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Is there a way to test if the
perch_events_event_categories
function is actually working?If you turn on debug, what does it output for the page?
If I made the path for the template correct, the page doesn't load at all, no debug, nothing.
Below is returned, if template path purposely broken:
SELECT DISTINCT e.* FROM perch2_events e WHERE eventSlug='2016-01-08-gncc-senior-mixed-curling-championship' SELECT c.* FROM perch2_events_categories c, perch2_events_to_categories e2c WHERE c.categoryID=e2c.categoryID AND e2c.eventID='12' SELECT * FROM perch2_events WHERE eventSlug = '2016-01-08-gncc-senior-mixed-curling-championship' SELECT categoryID FROM perch2_events_to_categories WHERE eventID = '12' SELECT c.* FROM perch2_events_categories c, perch2_events_to_categories e2c WHERE c.categoryID=e2c.categoryID AND e2c.eventID='12' SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Template file not found: /home/norfolkct/public_html/perch/addons/apps/perch_events/templates/events//events/event_category_link.html
Could the
perch_events_event_categories
function be screwing up the template path? I fixed the path and double checked that the template "event_category_link.html" exists both in the templates/events/ and in the apps/perch_events/templates folders (as a test) still nothing.I'm not sure where you are now. What problem are you currently having?
The following doesn't work or debug (unless I purposely break the path to the template, then debug works, but the it doesn't do anything, see above)
Ok, I'm probably out of suggestions then.
So there is no way to test if
perch_events_event_categories
is actually the issue? Why would the debug not work with correct path to linked template? Could this same function be done with straight PHP? (if so, how? :)