Posts by SixTillNine

    I would like to offer the user the ability to link to specific pages within a collection set.

    Eg allow the user to link to pages within a ‘case studies’ section either from a drop down list or a category style tag search box.

    I've found the answer somewhere else:

    Yeah, I did think of that, and also just using the _id - but using the slug I can't trust the users to keep it url friendly, and not duplicate it - which would lead to me having to sanitise it anyway.

    Using the sanitised title ensures URL (no weird characters) and SEO friendliness and greatly reduces the chances of duplication. A the users don't even have to think about it - which is the goal here.

    Woke up this morning and figured it out, remembering a post by the ever helpful hus_hmd.

    Excuse the poor PHP, coding is not my strength.

    I believe the above code creates an array based on the information output by the region. The 'each' function creates an instance of each of the multiple items in the region. The $service variable can be anything, I used $service for clarity (this could be $item, $article, $property - you get the idea).

    To access the title id of each item we put the name of the id in square brackets after the item variable, so my 'title' id can be accessed as:


    If I wanted the image it would be $service['image'] and so on...

    I manipulated the title using the same technique used to sanitise it for the href and if we get a match to the base name of the url the item is returned.

    When returned it honours the 'page' and 'template' declared in the call.

    I now have a multiple item region that can link to an SEO friendly individual page for each of the items.

    Happy days :-)

    The original post can be found here:…rder-of-repeaters-content

    I'm trying to filter a multiple item region based on a parameter obtained from the url. Normally this is straightforward, however the parameter is a modified id from the region I'm trying to filter.

    I have a list of services in multiple item region, for the purpose of the example we'll assume each service has only a id of "title":

    Service One

    Service Two

    Service Three

    The first page generates a menu linking to each of the services:

    1. <p><a href="/services/service-one">Service One</a></p>
    2. <p><a href="/services/service-two">Service Two</a></p>
    3. <p><a href="/services/service-three">Service Three</a></p>

    The sanitise filter takes the id "title" and creates a url friendly version of it using a template filter. This is used to create the href in the link.

    The menu links to a second page which is an index page within the /services directory. This page grabs the end of the url ready to filter the list.

    However as only the santized version of the "title" id is available is it possible to filter the list?

    Is there a way to filter based on a sanitised version of the title id?

    When linking an event to a category - the following error is thrown.

    1. Fatal error: Uncaught Error: Class 'PerchBlog_Cache' not found in /Volumes/Jobs/Websites/Mindforward/site-folder/manager/addons/apps/perch_events/runtime.php:217 Stack trace: #0 /Volumes/Jobs/Websites/Mindforward/site-folder/events/event.php(49): perch_events_event_categories('2019-05-30-reik...') #1 {main} thrown in /Volumes/Jobs/Websites/Mindforward/site-folder/manager/addons/apps/perch_events/runtime.php on line 217

    Unchecking the categories makes the error disappear.

    Can this be fixed.

    I have added a custom field to the event.html template:

    1. <perch:events
    2. id="courseLink"
    3. label="Course"
    4. type="courselist"
    5. suppress="true"
    6. divider-before="Course Info"
    7. />

    This is basically a modified version of page list that will provide the user with a drop down menu of pages based on their pageTreePosition. It returns a filename, for example:

    courseLink /reiki-level-1-connect-with-universal-energy.php

    However using perch_events_custom to filter on said courseLink value, the results are always zero.

    1. perch_events_custom(array(
    2. 'template' => 'events/listing/event-day.html',
    3. 'filter' => 'courseLink',
    4. 'match' => 'eq',
    5. 'value' => '/reiki-level-1-connect-with-universal-energy.php'
    6. ));

    Even changing the courseLink to a text field for a simpler value still didn't work.

    I'm able to filter on other values such as eventTitle

    1. perch_events_custom(array(
    2. 'template' => 'events/listing/event-day.html',
    3. 'filter' => 'eventTitle',
    4. 'match' => 'eq',
    5. 'value' => 'Tester Event'
    6. ));

    This works fine.

    Are we unable to filter on custom values within the events app?

    Hello Drew,

    I changed the value to '/events/test.php?s={eventSlug}'

    Duplicated the event.php file and renamed the file test.php, the links appeared - I reset the value back the it's original state and they are now being shown.

    All working now, but not sure why it wasn't, I only changed it and reverted back?

    To give you a bit more information, the basic-calendar.php template shows the entry in the calendar, but the href is empty:

    1. <a href="" class="test"><span class="time dtstart"><span class="value-title" title="2019-05-15T19:38:00+00:00"> 7:38PM</span> </span>
    2. <span class="summary ">Tester Event</span>
    3. </a>

    Same applies to the basic listing:

    1. <li class="vevent">
    2. <span class="time dtstart"><span class="value-title" title="2019-05-15T19:38:00+00:00"> 7:38 PM</span> - </span>
    3. <span class="event summary "><a href="">Tester Event</a></span>
    4. <div class="description">
    5. <p>Tester</p>
    6. </div>
    7. </li>

    The event slug is being written to the database: 2019-05-15-tester-event


    I'm calling in region information from another page and filtering the results. However when no results are returned the <perch:before> and <perch:after> sections are still being shown.

    The filters work fine and only show the information associated with the current page - however when there isn't any information associated it still returns the before and after code.

    The template is as follows: