I need to make Breakcrumb visible on some pages of content type.
Please help me out in putting php code which make the breakcrumb visible for:
Node id: 17
or
Node title: Journals.
Thanks a lot
I need to make Breakcrumb visible on some pages of content type.
Please help me out in putting php code which make the breakcrumb visible for:
Node id: 17
or
Node title: Journals.
Thanks a lot
Comments
Comment #1
MGN commentedIn the breadcrumb visibility box, you can insert php code that returns TRUE (show breadcrumb) or FALSE (don't show breadcrumb). You have access to the $node variable, so in this case the following would work for you:
return ($node->nid == 17) ? TRUE : FALSE;EDIT:
this is easier:
return ($node->nid == 17);Comment #2
pushkarpathak commentedThanks MGN! It worked.
Comment #3
pushkarpathak commentedMGN, one more help.
In custom breadcrumbs it is required to specify node type? What is node type of a View? I have a View which is Contents page of journal World Today. I had put its node type as World Today.
When I didn't specified any condition and did for all page of node type "World Today", it comes in all article page but not in Contents page.
What should I put to breakcrumb specifically for View page (Contents in my case)?
Thanks in advance
Comment #4
MGN commentedViews is not support in 6.x-1.4 (except by this patch http://drupal.org/node/323816#comment-1082064). But this feature has now been added (as an optional submodule) in custom breadcrumbs 6.x-2.x-dev.
Comment #5
pushkarpathak commentedThanks MGN!
But I am finding it very complicated to install patch to server. I am using a shared-hosting. Do you have any Tip which can help me in this?
Comment #6
MGN commentedIf you need views support, I would just install custom breadcrumbs 6.x-2.x-dev. If you have problems, that code will be supported whereas the patch will not. This may get around the problem that you are having, but its good to figure out how to install patches on your server as well. The handbook pages at http://drupal.org/patch/apply should help.
Comment #7
MGN commentedMarking this as fixed since the original question has been answered.
Comment #9
vdewar commentedreturn ($node->nid == 17);
Someone should add this into the documentation as an example of the Breadcrumb visibility use. I have been searching all over for just an example.
Since the Node Type on the Custom Breadcrumbs admin page just says "[type] with PHP snippet
I would also recommend users adding a comment /*to say what they are targeting*/, until a field is provided for a custom name
Comment #10
gellpak commentedI second this. Took me an hour on google and this site to figure this out.
Comment #11
Jsan2020 commentedWhat is not clear to me is whether you can use the tokens in the "Breadcrumb visibility" field. I am trying to check the node path to only override the breadcrumb on specific pages within a content type. Does anyone have an example for doing this?
Comment #12
MGN commented@Jsan2020 - no in the breadcrumb visibility field you have to write valid php (there isn't a token replacement phase). You do have access to the node object.
Please open a new support request since yours doesn't appear to be related to the original issue and people don't always review closed issues...
Comment #13
thamasJust for the record. One can use this method to support i18n (multilanguage sites).
For example to show the custom breadcrumb just for Hungarian nodes, write:
return ($node->language == hu);You can set multiple breadcrumbs for the same node type, and use dedicated language visibylity settings in each.
(Tested with 7.x-1.0-alpha1.)