Forum
perch_pages_navigation(); not working as expected with 'From Path'
Hi guys,
I'm having a little difficulty getting a section navigation menu set up with Perch.
I've got a page (titled "Our Treatments", with the path of "/our-treatments/"), that has multiple subpages.
I'm trying to only display the subpages, using this code:
<?php
perch_pages_navigation([
'template'=>'our-treatments-nav.html',
'include-hidden'=>true,
'from-path'=>'*'
]);
?>
however, this returns nothing at all. Removing the 'from-path' section shows ALL pages on the site (including the subpages).
Perch debug on the page shows this:
Debug Message - Perch 3.0.8
[1] SELECT * FROM perch3_pages WHERE pagePath='/our-treatments/index.php' LIMIT 1
Using template: /templates/pages/attributes/seo.html
[5] SELECT * FROM perch3_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch3_pages WHERE pagePath='/our-treatments/index.php' LIMIT 1
[1] SELECT pageID FROM perch3_pages WHERE pageTreePosition IN ('000-007', '000') ORDER BY pageTreePosition DESC
[5] Using template: /templates/navigation/header_nav.html
[2] SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/our-treatments/index.php' OR regionPage='*' ORDER BY regionPage DESC
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch3_content_regions WHERE regionKey='Title' AND (regionPage='/our-treatments/index.php' OR regionPage='*')
[1] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch3_content_index idx JOIN perch3_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch3_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=19 AND idx.itemRev=1)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval, regionID ORDER BY sortval ASC
[1] Using template: /templates/content//our-treatments/_title.html
[1] SELECT pageID, pageParentID, pageDepth, pageTreePosition FROM perch3_pages WHERE pagePath='/our-treatments/index.php' OR pageSortPath='/our-treatments/index.php' LIMIT 1
[1] SELECT * FROM perch3_pages WHERE pageNew=0 AND pageTreePosition LIKE '000-007%' ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch3_pages WHERE pagePath='/our-treatments/index.php' LIMIT 1
[1] SELECT pageID FROM perch3_pages WHERE pageTreePosition IN ('000-007', '000') ORDER BY pageTreePosition DESC
Here's my Summary Diagnostics:
Perch: 3.0.8, PHP: 5.4.13, MySQL: 5.5.30, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.8), assets (3.0.8), categories (3.0.8)
App runtimes: <?php $apps_list = [ ];
PERCH_LOGINPATH: /cms
PERCH_PATH: /var/www/vhosts/thirdfloordigital.net/cotswoldchiropractic.thirdfloordigital.net/cms
PERCH_CORE: /var/www/vhosts/thirdfloordigital.net/cotswoldchiropractic.thirdfloordigital.net/cms/core
PERCH_RESFILEPATH: /var/www/vhosts/thirdfloordigital.net/cotswoldchiropractic.thirdfloordigital.net/cms/resources
Image manipulation: GD Imagick
PHP limits: Max upload 128M, Max POST 8M, Memory: 128M, Total max file upload: 8M
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
Resource folder writeable: Yes
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
REQUEST_URI: /cms/core/settings/diagnostics/
DOCUMENT_ROOT: /var/www/vhosts/thirdfloordigital.net/cotswoldchiropractic.thirdfloordigital.net
HTTP_HOST: cotswoldchiropractic.thirdfloordigital.net
Any ideas?
If you don't include the
from-path
option, what do you get?Removing the 'from-path' section shows ALL pages on the site (including the subpages).
Does the current page get correctly highlighted?
No pages are highlighted, they're all just normal navigation links.
Is the current page part of the navigation?
Hi Drew,
Yes - the current page is part of the navigation and isn't hidden from the main navigation.
The subpages are, although I've included the:
option to deal with that.
Does anyone have any updates on this?
Do you have any more information you can give us? You have the site in front of you to try things - all we have is what you're describing to us.
Sure;
I've got a page (titled "Our Treatments", with the path of "/our-treatments/index.php"), that has multiple subpages.
On this page, I'm trying to display a list of all of the subpages.
The subpages are hidden from main navigation. Here is the code I am using:
This code is displaying every page on the site, as opposed to just the subpages.
How can I display just the subpages of the current page?
Thanks.
Hi Ray,
For testing, does being very specific by using
'from-path' => '/our-treatments/index.php',
display the list as intended?If so, does
'from-path' => dirname($_SERVER['PHP_SELF']) . '/index.php',
work?Hi Simon,
adding either of those in causes nothing to display, oddly!
Hi guys - this issue is now resolved. I've deleted and re-added the parent page and it's showing subpages as expected.
Thanks for the help.