Breadcrumbs - can someone check my PHP pls?
Permalink
Hi folks!
There are a couple of top level pages on my site that I want to hide from my header nav, so I checked the 'hide from nav' in the properties - job done, great.
BUT I did want the pages to appear in the breadcrumb trail. Of course they disappeared from that as well.
I duplicated the breadcrumb template and added it to the root and searched the forum. I found a thread that mentioned looking for and removing 'exclude_nav' so I found that in my file and commented it out. Not sure if I should have taken away the { and } as well because I am not a PHP bod.
It seems to be working but I am worried that I haven't deleted all the right bits and that this may cause probs further down the line.
Please can someone check it - here is the complete code for my Breadcrumb Template (C5 version 5.4.1):
Thanks,
Allison
There are a couple of top level pages on my site that I want to hide from my header nav, so I checked the 'hide from nav' in the properties - job done, great.
BUT I did want the pages to appear in the breadcrumb trail. Of course they disappeared from that as well.
I duplicated the breadcrumb template and added it to the root and searched the forum. I found a thread that mentioned looking for and removing 'exclude_nav' so I found that in my file and commented it out. Not sure if I should have taken away the { and } as well because I am not a PHP bod.
It seems to be working but I am worried that I haven't deleted all the right bits and that this may cause probs further down the line.
Please can someone check it - here is the complete code for my Breadcrumb Template (C5 version 5.4.1):
<?php defined('C5_EXECUTE') or die("Access Denied."); $aBlocks = $controller->generateNav(); $c = Page::getCurrentPage(); $nh = Loader::helper('navigation'); $i = 0; foreach($aBlocks as $ni) { $_c = $ni->getCollectionObject(); $pageLink = false; if ($_c->getCollectionAttributeValue('replace_link_with_first_in_nav')) { $subPage = $_c->getFirstChild(); if ($subPage instanceof Page) { $pageLink = $nh->getLinkToCollection($subPage); } }
Viewing 15 lines of 33 lines. View entire code block.
Thanks,
Allison