Breadcrumb trail hide link, but keep as a category title
PermalinkFor the the main navigation in my website, i just want to have the parent element display as a category name and not a clickable link, so i have selected the 'Don't Link in Navigation' option within custom attributes and this works great and does the job.
However the breadcrumb trail ignores this and will still let me click the url link. How can i make the breadcrumb trail behave in the same way?
Any help would be greatly appreciated.
Many Thanks
James

Many Thanks
James
it would be fairly easy to instruct if i had the source for the template that currently has this functionality working.
Click on the Custom Attributes tab, The attribute 'Don't Link in Navigation' appears on the left hand side under the title of 'Other'
Once selected you will need to scroll back to the top and click the Yes check box.
It has just occurred to me that i'm using the Super Fish plugin for my main nav, if what i have described above isn't visible to you i guess this is a feature of Super Fish that i wasn't aware of.
http://www.insynccreative.co.uk/siliconcpv5/c5/index.php/renewable-...
This is a link to the site i'm working on you will notice in the main nav 'RENEWABLE ENERGY SOLUTIONS isn't clickable but in the breadcrumb trail it is.
<?php defined('C5_EXECUTE') or die("Access Denied."); $navItems = $controller->getNavItems(true); for ($i = 0; $i < count($navItems); $i++) { $ni = $navItems[$i]; if ($i > 0) { echo ' <span class="ccm-autonav-breadcrumb-sep">></span> '; } $cObj = $ni->getCollectionObject(); $noLink = (bool)$cObj->getAttribute('replace_this_text_with_the_handle_found_in_attributes'); if ($ni->isCurrent || $noLink === true) { echo $ni->name; } else { echo '<a href="' . $ni->url . '" target="' . $ni->target . '">' . $ni->name . '</a>'; } }
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); class SuperfishPackage extends Package { protected $pkgHandle = 'superfish'; protected $appVersionRequired = '5.4.1'; protected $pkgVersion = '1.1.5'; public function getPackageName() { return t("Superfish"); } public function getPackageDescription() { return t("Create a drop-down navigation menu."); } public function install() { $pkg = parent::install(); //install related page attributes
I have used the 'dont_link' handle in the code you have provided to me, however i'm getting a fatal error message at line 8:
<?php defined('C5_EXECUTE') or die("Access Denied."); $navItems = $controller->getNavItems(true); for ($i = 0; $i < count($navItems); $i++) { $ni = $navItems[$i]; if ($i > 0) { echo ' <span class="ccm-autonav-breadcrumb-sep">></span> '; } $cObj = $ni->getCollectionObject(); $noLink = (bool)$cObj->getAttribute('dont_link'); if ($ni->isCurrent || $noLink === true) { echo $ni->name; } else { echo '<a href="' . $ni->url . '" target="' . $ni->target . '">' . $ni->name . '</a>'; } }
changed ->getCollectionObject() to ->cObj
like so:
<?php defined('C5_EXECUTE') or die("Access Denied."); $navItems = $controller->getNavItems(true); for ($i = 0; $i < count($navItems); $i++) { $ni = $navItems[$i]; if ($i > 0) { echo ' <span class="ccm-autonav-breadcrumb-sep">></span> '; } $cObj = $ni->cObj; $noLink = (bool)$cObj->getAttribute('dont_link'); if ($ni->isCurrent || $noLink === true) { echo $ni->name; } else { echo '<a href="' . $ni->url . '" target="' . $ni->target . '">' . $ni->name . '</a>'; } }