Posts by SixTillNine

    Thanks guys. I guess it’s a no.


    Blocks are useful however sometimes we want to slot a piece of content into an existing page template in an exact position (after a site has been built), and then have the region appear in the same semantic position in the admin area for existing pages (not just new ones).


    Perch doesn’t just add them to the end either. They appear to feature roughly but not exactly where we want. For example I tried to insert one at the start and it appeared second?!


    Maybe I need to double check one wasn’t declared anywhere above.

    Does anyone have a solution I could use for importing products into perch shop?


    I’m not a programmer so ideally would be looking for something I could copy.


    Ideal scenario is to import from a csv/excel as we want to quickly import 100s of products for testing into trial categories.

    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:


    $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?