Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Does anyone know how to make views display custom breadcrumbs?
I have been thinking you could pass an argument from views? But I have no idea how to do this, or if there is an easier way that I am missing. I am also still unsure if I am putting the correct labels in custom breadcrumbs. I have read and followed these instructions http://drupal.org/node/122654 on how to do this with no success yet.
I have the tokens module installed with custom breadcrumbs 5.x.1-2
Many thanks for the module!
Comments
Comment #1
eaton CreditAttribution: eaton commentedViews module already creates its own breadcrumb trails using its 'arguments' feature. Custom breadcrumbs was written because it was previously impossible to make *node* breadcrumbs match the breadcrumb trails that views auto-generates for its own pages. custom-breadcrumbs module has no way to alter breadcrumbs on any pages other than node/$nid...
Comment #2
lionstone CreditAttribution: lionstone commentedHi, Eaton, thanks for the help! I think what I need to do is import the view into a node page with a custom breadcrumb. I've been trying this but now the issue is that while the views import fine, the tabs don't reflect the new views...But this isn't an issue for this fourm anymore, I think! Thanks...
Comment #3
mikemccaffreyBut what if you are not using arguments in your view? What if the view is under /path1/path2/view and you want the breadcrumbs to show Home >> Path 1 Title >> Path 2 Title >> when view the view?
Comment #4
drupalfan2 CreditAttribution: drupalfan2 commentedHOW can I set the breadcrumb in a "views" when not using arguments!
Please help!
Comment #5
s.Daniel CreditAttribution: s.Daniel commentedfollowing
Comment #6
yopyop CreditAttribution: yopyop commentedI was having problems with getting Custom Breadcrumbs to show up on a simple view of node types, (and I'm also using node hierarchy module).
I'm not yet familiar with passing arguments in views, or how that would affect breadcrumbs, but here is a solution that worked for me - I followed the instructions here - http://drupal.org/node/158583 in experimenting with the weights of the custom breadcrumb module in the system table - I set it to 1 instead of 0, and it worked, breadcrumbs set for that node type show up now.
Comment #7
psynaptic CreditAttribution: psynaptic commentedDon't know if anyone is still following this issue but if you need to have a breadcrumb for a View you can define it in template.php:
Comment #8
abu3abdalla CreditAttribution: abu3abdalla commentedthank you but would u please make it for DRUPAL 6 to help the community
Comment #9
MGN CreditAttribution: MGN commentedI have posted a patch extending custom breadcrumbs for views (with or without arguments) for 6.x-1.4 at #323816: Extending custom_breadcrumbs for views, paths, and panels. It needs testing, but is working for me and might be of help.
Comment #10
nocte CreditAttribution: nocte commented@psynaptic: this code doesn not have any effect in my Druapl 6.. :-(
Comment #11
capellicIT works fine in Drupal 6. Be sure you adjust the "if" statement to match the path for the breadcrumb you want to manipulate.
In my case, I have a View that lists all of my "News" content types. The path of the View is "news/category" and it accepts the term id as an argument (and this is why I am using the substr function to only get the first 13 characters). I want any argument filtering of the View to show show a "News" breadcrumb. This is how I did it:
If course, you will have to adjust your path and length of the substr to match the length of the path.
Comment #12
londondave CreditAttribution: londondave commentedI am using drupal 6
I have the custom breadcrumbs module installed and I am stuck with how to get this to work with views. Maybe it's not possible, but as an example, what I need is the following:
user clicks on a front page link of say 'film reviews:scifi' which is a view with path: views/films/filmsview_scifi. I need a way to build this path using tokens?
Title would be [term]
path would be views/films/?
how do i get the view title dynamically using tokens? I have multiple film review views eg 'film reveiws: action' etc, so the last bit of the view path 'filmsview_scifi', filmsview_action' etc needs to be built dynamically?
At this point the breadcrumb would be home >> films:sci-fi, if the user clicks on films:sci-fi it needs to go back to the view
Then in the view page there are rows of film title links, user might click on row 1 with title 'sphere' which is a link to path: content/films/scifi/443-sphere. How would you create a custom breadcrumb for this part?
The breadcrumb should look like:
home >> films:sci-fi >> 443-sphere
Any ideas would be greatly appreciated. Something tells me there must be a way to do this with the custom breadcrumbs module for drupal 6.
At this point my titles look like:
[term]
[nid]-[title]
And paths look like:
views/films/?
content/films?
How do you build these paths and can it work?
My email is desktopdave@tiscali.co.uk
Comment #13
londondave CreditAttribution: londondave commentedComment #14
MGN CreditAttribution: MGN commentedTwo possibilities:
Views support is now in custom breadcrumbs 6.x-2.x-dev for testing. The tokens that you want are arg(x). See #273893: Argument tokens using arg() for a patch. It looks like this is destined for the token starter kit, but that patch still needs to be tested and committed. So your feedback on that issue would also be helpful.
You can also See #424464: CB for Views: let views create customizable breadcrumbs for a views patch that allows setting the breadcrumb as you edit the view.
I hope this helps. Since views support is still being developed for custom_breadcrumbs, please report back when you identify the solution that works for you.
Thanks
Comment #15
londondave CreditAttribution: londondave commentedThanks for that.
Setting the breadcrumb in the view itself is a good idea, but I am a bit wary of using patches. The patch they have there is for 2.4 while views for drupal 6 is now 2.5.
At the moment using the custom breadcrumb module as you say above there is no way to get that last argument for say views/films/actual-views-path-name
I have so far
Title
[term] -this works
[title]-this works
Path
views/films/??? tried [tid] but not accepted as a token, tried [nid] still no good.
node/[nid] -this works
So if you could tell the custom breadcrumb module to use the path to the current page for the view eg
views/films/[path-completed]
then it would work, the last line would need a token that would complete the path in the address bar?
Comment #16
MGN CreditAttribution: MGN commentedYes. The arg tokens return any part of the path, either aliased or raw. So you'll need to either test out the token starter kit (with token 6.x.1.x-dev) and greggles patch at #273893: Argument tokens using arg(), or wait until others do and it gets released in the next stable version. I am using arg tokens for my views pages they work fine for my needs. Sorry, at this point its all dev code, so be cautious (or adventurous?). But the more people that test, the faster it becomes stable... ;-)
Comment #17
londondave CreditAttribution: londondave commentedThanks for the advice MGN, I think I will give it a try and let you know how it goes.
So I patch token module 6.x.1.x-dev with the last greggle patch on the page '#273893: Argument arg() support in Token' (comment #16)? That downloaded as 'views_argument_breadcrumbs.patch'
I'm a bit confused with which token dev module and which patch?
Thanks for your help.
Comment #18
mroscar CreditAttribution: mroscar commenteddeleted... my solution was ... funny
Comment #19
dooug CreditAttribution: dooug commentedRE:#7 Wonderful! The phptemplate_breadcrumb was just what I was looking for. Although I did find that the following code was unnecessary:
I'm looking forward for the Custom_Breadcrumbs 6.x-2.x working with views.
Comment #20
londondave CreditAttribution: londondave commentedHi,
I have a custom front page of links to views, my breadcrumbs need to work like this:
home >> path to view from frontpage link >> nid-title of node eg:
home >> cars >> 189-cars-that-use-cooking-oil
I can set the path to the view on the custom breadcrumbs 2 admin page, so in the above case 'cars' is the title given to the view path- clicking 'cars' works, it takes the user back to the view page.
The view page produces a table of links to nodes that is taxonomy based, so how do I set the breadcrumb to just get 'nid-titleOfNode', without it recreating the breadcrumb path and removing the working 'cars' view breadcrumb?
Comment #21
MGN CreditAttribution: MGN commented@londondave, can you open a new support request. I nearly missed your request because it was tacked on to an old issue with status 'by design.' We can address your question more fully on a new issue.
When you open it, please indicate on what type of page are you trying to get the breadcrumb to be
home >> cars >> 189-cars-that-use-cooking-oil
Is this a breadcrumb for a node or a view page (or something else)? What type of breadcrumb have you tried to create for these pages? Also, indicate what you have tried to put in the titles and paths sections.
For the path nid-title of node (assuming you are using pathauto) have you tried
Comment #22
solona CreditAttribution: solona commentedThanks for #7!
It helped me write a function that sets the breadcrumb based on the path alias, which seems intuitive to me. It supercedes the need for the Custom Breadcrumb module.
*(In cases where your alias does not match the page title, you will need to write these manually. Eg: An About Us page with the alias of 'about')*
Comment #23
rplescia CreditAttribution: rplescia commentedStupid question but do i put this piece of code in the template.php file?
Comment #24
solona CreditAttribution: solona commentedYes.
Comment #25
rplescia CreditAttribution: rplescia commentedthanks
Comment #26
solona CreditAttribution: solona commentedComment #27
laevensv@gmail.com CreditAttribution: laevensv@gmail.com commentedThanks a lot, solona !
For my need i just added a piece of code to avoid breadcrumb looks like "content>title"
if ($alias_parts[0] != $path_alias) {
if($page_title == "Content") {
$breadcrumb[] = l(drupal_get_title(), $path_alias);
}else {
$breadcrumb[] = l($page_title, $alias_parts[0]);
$breadcrumb[] = l(drupal_get_title(), $normal_path); // Link to current URL
}
}
Comment #28
gbrands CreditAttribution: gbrands commentedI was getting an array to string error so I modified the code in post #22 to this:
Comment #29
opegasus CreditAttribution: opegasus commented#'s 22 & 28 Almost worked for me...thanks. Did print the links but unfortunately clicking back on those links either worked or came back to "page not found" error. Soooo close. Plus in one instance it switched the order of the links...odd.
The pages are being created by Views so I wonder if I must either use Custom Breadcrumbs or figure out how to use the Views Breadcrumb feature?
Nice work on those two PHP snippets though. Hopefully they will work for others.
P.S. I actually had to put the code into includes/theme.inc because when it was placed in template.php, 'includes' threw a fit and erred out the site.
Comment #30
adelka CreditAttribution: adelka commentedWorks for me!
Just wto question - is ist possible to:
- change "home" text to something else
- make current node title not clickable (no )
Thank you!
Comment #31
rakesh.gectcrPlease check this module
Views bread crumb modue
https://drupal.org/sandbox/rakeshjames/2049937
Comment #32
lamp5