Breadcrumb trail hide link, but keep as a category title

Permalink
Hello

For 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

 
cherrycake replied on at Permalink Reply
cherrycake
are you comfortable with php? if so, copy the breadcrumb template from /concrete/blocks/autonav/templates to /blocks/autonav/templates. add a check for the attribute (you can check how the other templates are doing it) and save the file. that should be it.
xxjames1975xx replied on at Permalink Reply
Thank you for your response, unfortunately i don't know php that well, your suggestion is it something that you could easily paste in a reply that i could then add to my breadcrumb.php file?

Many Thanks

James
cherrycake replied on at Permalink Reply
cherrycake
i assumed this was a new feature i wasn't aware of in concrete (don't link in navigation) but couldn't find it so i assume you're using an addon/theme that has this functionality?

it would be fairly easy to instruct if i had the source for the template that currently has this functionality working.
xxjames1975xx replied on at Permalink Reply
To enable the 'Don't Link in Navigation' attribute you need to go to the sitemap, then select a page and choose Properties.

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.
cherrycake replied on at Permalink Reply
cherrycake
ah. unfortunately i dont have the code for that addon so i don't know the handle of the attribute. i'll give it a try though and you can test to put the following under /blocks/autonav/templates/breadcrumb.php. just make sure to look up the handle for the attribute under page attributes and replace the one below with that.

<?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>';
    }
}
xxjames1975xx replied on at Permalink Reply
Thanks for taking the time to help me with this, if i understand correctly i have looked in the superfish controller.php file and this is the code:

<?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>';
    }
}
cherrycake replied on at Permalink Best Answer Reply
cherrycake
sorry messed up there on line 8.

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>';
    }
}
xxjames1975xx replied on at Permalink Reply
Thats great, thanks so much for your help on this :)