Posts by SixTillNine

    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:


    $service['title']


    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:

    https://grabapipit.com/blog/re…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:


    Code
    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.


    Code
    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:


    Code
    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.

    Code
    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

    Code
    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:


    Code
    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:


    Code
    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

    Hello,


    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:

    I've just installed the events app and added an event.


    The event shows up in the included sample listing views such as basic calendar and basic listing. However the link to view the event does not work it is simply an empty HREF tag.


    Looking at the template there should be an event url id being returned <perch:events id="eventURL" />.


    Is there a stage I am missing?


    Extended diagnostics are as follows:


    Perch information

    • Perch LTM: 3.1.5
    • Production mode: Production (100)
    • Installed apps: content (3.1.5), assets (3.1.5), categories (3.1.5), perch_events (1.9.5)
    • DB driver: PDO
    • DB tables: perch3_categories (0), perch3_category_counts (0), perch3_category_sets (0), perch3_content_index (303), perch3_content_items (44), perch3_content_regions (22), perch3_events (1), perch3_events_categories (3), perch3_events_to_categories (1), perch3_menu_items (9), perch3_navigation (1), perch3_navigation_pages (1), perch3_page_templates (7), perch3_pages (10), perch3_resource_log (28), perch3_resource_tags (0), perch3_resources (23), perch3_resources_to_tags (0), perch3_settings (22), perch3_user_passwords (0), perch3_user_privileges (32), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (1)
    • Users: 1
    • App runtimes:
      PHP
      1. <?php
      2. $apps_list = [
      3. 'perch_events'
      4. ];
    • Editor plug-ins:
    • H1: 9f787617e94b456f59d543c452c88d73
    • L1: f4e58a6ee1c76acdd4053ea9b0989a4d
    • F1: 3b606135b33e6a102526838f4152a807
    • headerColour: #ffffff
    • content_singlePageEdit: 1
    • helpURL:
    • siteURL: /
    • hideBranding: 1
    • content_collapseList: 1
    • lang: Better-en-gb
    • installedAt: 3.1.5
    • update_3.1.5: done
    • latest_version:
    • on_sale_version: 3.1.5
    • headerScheme: light
    • dashboard: 0
    • sidebar_back_link: 0
    • hide_pwd_reset: 0
    • keyboardShortcuts: 0
    • content_hideNonEditableRegions: 0
    • content_frontend_edit: 0
    • content_skip_region_list: 0
    • assets_restrict_buckets: 0
    • logoPath: /manager/resources/stn-logo.svg
    • perch_events_update: 1.8
    • PERCH_DEVELOPMENT: 10
    • PERCH_STAGING: 50
    • PERCH_PRODUCTION: 100
    • PERCH_DB_USERNAME: root
    • PERCH_DB_SERVER: localhost
    • PERCH_DB_DATABASE: mindforward
    • PERCH_DB_PREFIX: perch3_
    • PERCH_TZ: UTC
    • PERCH_LOGINPATH: /manager
    • PERCH_PATH: /Volumes/Jobs/Websites/Mindforward/site-folder/manager
    • PERCH_CORE: /Volumes/Jobs/Websites/Mindforward/site-folder/manager/core
    • PERCH_RESFILEPATH: /Volumes/Jobs/Websites/Mindforward/site-folder/assets/img
    • PERCH_RESPATH: /assets/img
    • PERCH_HTML5: 1
    • PERCH_RUNWAY:
    • PERCH_ERROR_MODE: DIE
    • PERCH_DATE_LONG: %d %B %Y
    • PERCH_DATE_SHORT: %d %b %Y
    • PERCH_TIME_SHORT: %H:%M
    • PERCH_TIME_LONG: %H:%M:%S
    • PERCH_RUNWAY_ROUTED:
    • PERCH_STRONG_PASSWORDS:
    • PERCH_ASSET_VERSION: 6738d5d5f5664f7c5e34
    • PERCH_DEBUG:
    • PERCH_PREVIEW_ARG: preview
    • PERCH_TEMPLATE_PATH: /Volumes/Jobs/Websites/Mindforward/site-folder/manager/templates
    • PERCH_TEMPLATE_FILTERS:
    • PERCH_DEFAULT_DOC: index.php
    • PERCH_DEFAULT_EXT: .php
    • PERCH_PRODUCTION_MODE: 100
    • PERCH_XHTML_MARKUP:
    • PERCH_RWD: 1
    • PERCH_HTML_ENTITIES:
    • PERCH_SSL:
    • PERCH_STRIPSLASHES:
    • PERCH_PROGRESSIVE_FLUSH: 1
    • PERCH_PARANOID:
    • PERCH_FORCE_SECURE_COOKIES:
    • PERCH_DEFAULT_BUCKET: default
    • PERCH_TRANSLATION_ASSIST:
    • PERCH_PASSWORD_MIN_LENGTH: 6
    • PERCH_MAX_FAILED_LOGINS: 10
    • PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
    • PERCH_VERIFY_UPLOADS:
    • PERCH_PRIV_ASSIST:
    • PERCH_CUSTOM_EDITOR_CONFIGS:
    • PERCH_ENABLE_EXIF: 1
    • PERCH_AUTH_PLUGIN:
    • PERCH_DB_CHARSET: utf8
    • PERCH_DB_PORT:
    • PERCH_DB_SOCKET:
    • PERCH_APPS_EDITOR_PLUGIN: markitup
    • PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown

    Hosting settings

    • PHP: 7.1.12
    • Zend: 3.1.0
    • OS: Darwin
    • SAPI: cgi-fcgi
    • Safe mode: not detected
    • MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $
    • MySQL server: 5.6.38
    • Free disk space: 12.48 GB
    • Extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, session, standard, mysqlnd, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, mysqli, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, imap, gettext, mcrypt, pgsql, pdo_pgsql, igbinary, memcached
    • GD: Yes
    • ImageMagick: No
    • PHP max upload size: 32M
    • PHP max form post size: 32M
    • PHP memory limit: 256M
    • Total max uploadable file size: 32M
    • Resource folder writeable: Yes
    • Session timeout: 24 minutes
    • Native JSON: Yes
    • Filter functions: Yes
    • Transliteration functions: Yes
    • PHP_FCGI_CHILDREN: 4
    • PWD: /Applications/MAMP/fcgi-bin
    • PHP_FCGI_MAX_REQUESTS: 200
    • __CF_USER_TEXT_ENCODING: 0x1F6:0x0:0x2
    • ORIG_SCRIPT_NAME: /fcgi-bin/php7.1.12.fcgi
    • ORIG_PATH_TRANSLATED: /Volumes/Jobs/Websites/Mindforward/site-folder/manager/core/settings/diagnostics/index.php
    • ORIG_PATH_INFO: /manager/core/settings/diagnostics/index.php
    • ORIG_SCRIPT_FILENAME: /Applications/MAMP/fcgi-bin/php7.1.12.fcgi
    • SCRIPT_NAME: /manager/core/settings/diagnostics/index.php
    • REQUEST_URI: /manager/core/settings/diagnostics/?extended
    • QUERY_STRING: extended
    • REQUEST_METHOD: GET
    • SERVER_PROTOCOL: HTTP/1.1
    • GATEWAY_INTERFACE: CGI/1.1
    • REDIRECT_URL: /manager/core/settings/diagnostics/index.php
    • REDIRECT_QUERY_STRING: extended
    • REMOTE_PORT: 61818
    • SCRIPT_FILENAME: /Volumes/Jobs/Websites/Mindforward/site-folder/manager/core/settings/diagnostics/index.php
    • SERVER_ADMIN: you@example.com
    • DOCUMENT_ROOT: /Volumes/Jobs/Websites/Mindforward/site-folder
    • REMOTE_ADDR: ::1
    • SERVER_PORT: 8888
    • SERVER_ADDR: ::1
    • SERVER_NAME: dev.mindforward.loc
    • SERVER_SOFTWARE: Apache
    • PATH: /usr/bin:/bin:/usr/sbin:/sbin
    • HTTP_ACCEPT_ENCODING: gzip, deflate
    • HTTP_ACCEPT_LANGUAGE: en-gb
    • HTTP_REFERER: http://dev.mindforward.loc:888…ore/settings/diagnostics/
    • HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15
    • HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    • HTTP_UPGRADE_INSECURE_REQUESTS: 1
    • HTTP_CONNECTION: keep-alive
    • HTTP_COOKIE: PHPSESSID=a79167bd41962c80c48be77279cad6c5; cmsa=1
    • HTTP_HOST: dev.mindforward.loc:8888
    • REDIRECT_STATUS: 200
    • REDIRECT_HANDLER: php-fastcgi
    • FCGI_ROLE: RESPONDER
    • PHP_SELF: /manager/core/settings/diagnostics/index.php
    • REQUEST_TIME_FLOAT: 1557569545.73
    • REQUEST_TIME: 1557569545
    • argc: 1

    Sorry, I don't think that is the case.


    Here is the full set of the blocks code, as you will see it contains all the required surrounding tags (I am actually using it to build pages) - however it ignores the limit I apply to the image strip block:


    I have the following image repeater inside a block, I have tried to limit the repeater to 3 items however it doesn't work. You can add as many as you like.


    Is this a limitation of the repeater and block combination?