My problem: nodes don't display a breadcrumb back to the page that displayed them, they just display "Home". I appreciate that this is because a node could be displayed from a number of places in a site so Drupal can't assume the breadcrumb trail.
However, is it possible to pass something to a node to tell it who called it? This would enable the breadcrumb to be constructed on the basis of the calling page.
For example, I have a menu structure like this:
- General info
- Static page
- Another static page
- News
- Special info
- Static page
- Another static page
- News
News stories under "Special info" are a subset of those under "General info". A news story can therefore be reached from 2 places.
I click "General info" and then "News". The list of general news stories will be displayed with the breadcrumb:
Home > General info
I then click on a story in the list which then is displayed. The page is passed something that says that the calling page was "general info" so it will therefore display the breadcrumb
Home > General info > News
Alternatively, I click on "Special info" and then "News". I then click on the same story as before. This time it is passed something that tells it that "Special news" was the calling page and displays the breadcrumb
Home > Special info > News
In both cases I can take the user back to their place in the site prior to clicking on the node.
All the solutions that I've seen are taxonomy or path based and I'm not convinced this is the answer - I need something that reflects the previous page.
Any suggestions?
Graeme.
Comments
an idea
How about, instead of reworking all the dozens of links with extra parameters ...
In your theme or thereabouts, if there is no explicit breadcrumb set, calculate a breadcrumb based on the http referrer.
I noticed taxonomy_html managed to get the effect right, putting a breadcrumb for nodes that were categorised.
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
HTTP referrer
Thanks Dan, that makes sense.
Any pointers on what I do with the HTTP referrer to generate the breadcrumb? I've searched the forum and Goolgled for examples but can't find any.
I'm surprised that no-one else has done something like this - providing a context sensitive breadcrumb (and menu) on a node seems a sensible thing to do to help maintain a 'sense of place' in a site for the user.
Sorted!
In case anyone else has this problem, here's a thread that gave me the clue I needed (contributed to by Dan, thanks again).
http://drupal.org/node/141494
In a nutshell...
As icing on the cake
gives you what you need to add a link to the referring page into the breadcrumb.
Wrap it all up in a module as per the above thread and Bob's your proverbial. How cool is Drupal?
Good-o
Actually yes. I was a bit wary of doing this as there are a slew of confusions possible when a client wants an arbitrary 'back' button on normal pages (learn to use your browser buttons!) as 'back' means different things in different places, and can end up trivially confusing results.
But that's old-school static page thinking.
Running under a CMS, where that info is there to be used, and you are on a shallow site this can be done OK. Breadcrumbs are not as tricky however, and I might try it. At the moment I'm doing some AJAX page loads, which have their own problems :)
What if a content page links to another content page?
Did you do that in your $page.tpl.php or where? I guess theme_breadcrumb() is a good place. It shouldn't need a stand-alone module, but I like small trivial modules sometimes :)
Yes, maybe this trick does deserve serious promotion!
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
No disagreement with any of that
I think this navigation model work fine if breadcrumbs are treated as a way of indication position / navigating within a vertical silo in the site rather than the path to a particular page in the site.
Your point about content to content linking is an interesting one. I didn't think in the site I'm developing that would arise but I guess there's nothing to stop an author creating a link in their story to an existing story... I'll investigate... there's always gotcha somewhere isn't there?
I created a really simple module called "referring page breadcrumb" to do it. I think (it was in the wee small hours!) that I also investigated doing it in a template but either I couldn't do it or I thought that when I hand the site over it would be neater to have the functionality hidden away in a module.
Thanks again for giving me the steer.
Graeme.
subscribing
subscribing
where to modify
Hi
Meerkat,
above function are found in common.inc file..
so i need to modify there or not..
Please help me!!
I need correct breadcrumb for static pages..