Forum

Thread tagged as: Problem

perch_pages_navigation ignoring from-path

Hi,

I'm having a problem where perch_pages_navigation is ignoring the from-path specified. I've used similar code in my sidebar navigation which works perfectly, but I'm now trying to show section navigation in the footer of the website.

I have the following code in the footer layout of my page:

<!-- displays section heading -->
<?php perch_pages_navigation(array(
            'from-path' => '/buying-from-inspired',
            'from-level' => 1,
            'include-parent' => true,
            'template' => 'navigation_heading.html'
)); ?>
<!-- displays section navigation-->
<?php perch_pages_navigation(array(
            'from-path' => '/buying-from-inspired',
            'from-level' => 1,
            'include-parent' => true,
            'template' => 'navigation.html'
)); ?>

In my 'navigation_heading.html', I have the following code:

<perch:before><h5></perch:before>
<perch:pages id="pageNavText"/>
<perch:after></h5></perch:after>

And finally, in my 'navigation.html', I have this code:

<perch:before>
    <ul>
</perch:before>
        <li>
            <a href="<perch:pages id="pagePath" />"><perch:pages id="pageNavText" /></a>   
        </li>
        <perch:pages id="subitems" encode="false" />
<perch:after>
    </ul>
</perch:after>

Yet in both the heading and the navigation items, they're including all other pages in the site (which at the moment is currently just the Contact page):

navigation error preview

Does anyone have any idea where I'm going wrong?

Philip Gwynne

Philip Gwynne 1 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you turn debug on for the page, what does it output?

I'm getting the following output:

(Note: I now have navigation.html and navigation_subitems.html (for the main nav) and footer_navigation_heading.html and footer_navigation.html for the footer navigation. They're exactly the same other than the header nav has different html markup to allow for dropdown menus. They all still however, show the entire pages in the site for each nav heading and navigation items.)

DIAGNOSTICS:
SELECT * FROM perch2_pages WHERE pagePath='/buying-with-inspired/index.php' LIMIT 1
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
SELECT * FROM perch2_pages WHERE pagePath='/buying-with-inspired/index.php' LIMIT 1
SELECT regionKey, regionHTML FROM perch2_content_regions 
WHERE regionPage='/buying-with-inspired/index.php' OR regionPage='*' ORDER BY regionPage DESC
SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Contact Details' AND (regionPage='/buying-with-inspired/index.php' OR regionPage='*')
SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx 
JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID
JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID='29' AND idx.itemRev='9')) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev
) as tbl GROUP BY itemID ORDER BY sortval ASC 
Using template: /templates/content/global/contact_details_telephone.html
SELECT pageID, pageParentID, pageDepth, pageTreePosition FROM perch2_pages WHERE pagePath='/buying-from-inspired' OR pageSortPath='/buying-from-inspired' LIMIT 1
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/buying-with-inspired/index.php' LIMIT 1
SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-001', '000')
Using template: /templates/navigation/navigation.html
Using template: /templates/navigation/navigation_subitems.html
Using template: /templates/navigation/navigation_subitems.html
Using template: /templates/navigation/navigation_subitems.html
SELECT * FROM perch2_pages WHERE pagePath='/buying-with-inspired/index.php' LIMIT 1
SELECT pageID, pageParentID, pageDepth, pageTreePosition FROM perch2_pages WHERE pagePath='/buying-with-inspired/index.php' OR pageSortPath='/buying-with-inspired/index.php' LIMIT 1
SELECT pageID, pageParentID, pageDepth, pageTreePosition FROM perch2_pages WHERE pageTreePosition='000-001' LIMIT 1
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageTreePosition LIKE '000-001%' ORDER BY pageTreePosition ASC
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/buying-with-inspired/index.php' LIMIT 1
SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-001', '000')
Using template: /templates/navigation/sidebar_heading.html
SELECT pageID, pageParentID, pageDepth, pageTreePosition FROM perch2_pages WHERE pagePath='/buying-with-inspired/index.php' OR pageSortPath='/buying-with-inspired/index.php' LIMIT 1
SELECT pageID, pageParentID, pageDepth, pageTreePosition FROM perch2_pages WHERE pageTreePosition='000-001' LIMIT 1
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageTreePosition LIKE '000-001%' ORDER BY pageTreePosition ASC
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/buying-with-inspired/index.php' LIMIT 1
SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-001', '000')
Using template: /templates/navigation/sidebar_menu.html
SELECT pageID, pageParentID, pageDepth, pageTreePosition FROM perch2_pages WHERE pagePath='/buying-from-inspired' OR pageSortPath='/buying-from-inspired' LIMIT 1
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/buying-with-inspired/index.php' LIMIT 1
SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-001', '000')
Using template: /templates/navigation/footer_navigation_heading.html
SELECT pageID, pageParentID, pageDepth, pageTreePosition FROM perch2_pages WHERE pagePath='/buying-from-inspired' OR pageSortPath='/buying-from-inspired' LIMIT 1
SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/buying-with-inspired/index.php' LIMIT 1
SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-001', '000')
Using template: /templates/navigation/footer_navigation.html
SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx 
JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID
JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID='29' AND idx.itemRev='9')) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev
) as tbl GROUP BY itemID ORDER BY sortval ASC 
Using template: /templates/content/global/contact_details_address.html
SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx 
JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID
JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID='29' AND idx.itemRev='9')) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev
) as tbl GROUP BY itemID ORDER BY sortval ASC 
Using template: /templates/content/global/contact_details_telephone.html
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0

Sorry for wasting your time Drew, completely my fault - I've just seen where I was going wrong! :(

I had from-path as "/buying-from-inspired" and I set the page up as "/buying-with-inspired" - Amateur moment!