Posts by SixTillNine
-
-
Thanks Byron, The monitor only accesses the homepage and it only happens occasionally. We have increased the resources so hopefully it won’t happen again.
-
Solved. I hadn’t wrapped the sample filter in php tags.
-
That’s how I’m creating the regions using master templates. For new pages it’s fine they appear in the order they are declared. What I’m trying to do is slot one into a specific place in an existing master page.
-
Bizarrely adding a region at the end as well as the one in the middle or at the start kicks all the other regions into perfect order.
You just end up with a region at the end you don’t want.
-
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 also like to know if this is going to be addressed. We have a shop going live very shortly and this has me a little concerned.
-
Try <perch:blog id=“_id” />
-
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.
-
is it possible to create a set of manageable options for the user to choose from when creating pages?
Eg give them an area/page of the site they could manage colours, so they can add new ones. Then on a separate page allow them to choose the colours from checkboxes?
-
I've found the answer somewhere else:
PHP- <?php
- $pageList = perch_pages_navigation([
- 'skip-template' => true,
- 'from-path' => '/path-to-pages/',
- 'levels' => 1,
- 'hide-extensions' => false,
- ]);
- array_multisort(array_column($pageList, 'pageTreePosition'), SORT_ASC, $pageList);
- $paths = array_column($pageList, 'pagePath');
- foreach ($pageList as &$path) {
- perch_content_custom('Region Name', array(
- 'template' => 'template.html',
- 'page' => $path,
- ));
- }
- ?>
-
Hello,
My aim is to run perch_content_custom for all pages within a certain area of the site.
I can get a list of all the page urls from perch_pages_navigation, how do I loop those each one of those urls through perch_content_custom?
The end goal is to generate a menu using information within the regions of those pages.
-
Hello,
Is it possible to set variants to add a value to the base price?
Say a widget is base price £10.00
Selecting large adds £2.50
Selecting red adds a further £3.50
Is this possible?
-
OK, just found the docs for the slug field type, now I understand what you mean by more efficient.
-
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.
Code- perch_content_custom('Services', [
- 'page' => '/service-list.php',
- 'template' => 'services/service_details.html',
- 'each' => function($service) {
- $title = $service['title'];
- $dashed = strtolower(str_replace(' ', '-', $title));
- $stubbed = preg_replace('/[^A-Za-z0-9\-]/', '', $dashed);
- $url = $_SERVER['REQUEST_URI'];
- $basename = basename($url);
- if($stubbed == $basename){
- return $service;
- }
- }
- ]);
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:
-
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:
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?
-
Is it possible to show message for a month where there are no events? This is only for the perch_events_listing().
Essentially this would be a blank-month template.
-