Closed (fixed)
Project:
Custom Breadcrumbs
Version:
6.x-2.0-beta2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 Jan 2010 at 11:13 UTC
Updated:
25 Jan 2010 at 07:30 UTC
I have a client who has just ONE page in the whole site where he wants the breadcrumb title to be different to the actual node title. Am I right in thinking your excellent module could do this for me?
Comments
Comment #1
ludo1960 commentedJust use drupal_set_breadcrumb()
Comment #2
artatac commentedthanks - I have tracked the code down to common.inc and adapted the code as follows
unfortunatly it is ignoring my crude attempts!
Comment #3
ludo1960 commentednope, just add php code to the one page that you want to change
Comment #4
artatac commentedThanks _ I will look into it again
Comment #5
ludo1960 commentedtry:
Comment #6
artatac commentedTHanks for your guidance .. and patience. Have created a custom templade just for relevant node > when I remove
print $breadcrumb;the breadcrumb disappears so I know I have the right template! but when I then add the code above the breadcrumb remains empty
Should a print line be included?
Comment #7
MGN commentedCustom breadcrumbs could do this, but I agree with ludo1960 that this is not necessary for a single breadcrumb.
In your sites template.php file (in the theme directory) find the phptemplate_breadcrumb function. If you don't have a template.php file (or this function), you can add your own and modify it to check to see if you are on that special page where the breadcrumb gets modified.
In the example below, replace '/path/to/page' with the relative url to the page, and adjust the links to suit your needs (building on ludo1960's example)
Notice when you do it this way, you don't use drupal_set_breadcrumb - you just redefine the $breadcrumb array variable.
Comment #8
artatac commentedthat is terrific thanks - and working well - the final piece in the jigsaw is dealing with more than one (child page for which you want the custom breadcrumb eg:
if (url($_GET['q']) == '/tags-explained/tags-two') { becomes something like
if (url($_GET['q']) == '/tags-explained/tags-two' OR '/tags-explained/tags-three' or '/tags-explained/tags-four') {
or maybe
if (url($_GET['q']) ==(CONTAINS '/tags-explained/...') {
Thanks for your time - I am a Graphic designer (not a coder!) by trade let me know if I can return the favour to either of you
Comment #9
MGN commentedNo problem. There are several ways to do this, but you might try
This finds the position of the first occurrence of '/tags-explained/' in the url. If it doesn't occur, then the strpos returns false...
Comment #10
artatac commentedWorks a treat - thanks SO MUCH!!
Comment #11
MGN commentedGreat! Closing this issue since the question has been answered. Also changing the title so its easier to find when searching do.
Comment #12
artatac commentedDOH!
having checked my real theme (based on pixtureRR) - rather than the Garland one I was using to test the idea, it HAS a template.php but no function phptemplate_breadcrumb. I tried just adding the above code but no luck.
I presume I am sheepishly asking for guidance to... just "redefine the $breadcrumb array variable."
Comment #13
ludo1960 commentedBaah!!