By steven1350 on
Lets say that I have a URL as follows: content/departments/dept1/article
Is there a way so that the breadcrumbs are generated by just using this creating
Home >> Content >> Departments >> Dept1
Thanks
Lets say that I have a URL as follows: content/departments/dept1/article
Is there a way so that the breadcrumbs are generated by just using this creating
Home >> Content >> Departments >> Dept1
Thanks
Comments
=-=
custom_breadcrumbs.module may be worth investigating.
.
what exactly does this do?
_
http://drupal.org/project/custom_breadcrumbs ?
.
how do I use this to get breadcrumbs from the url?
=-=
it won't be pulling directly form the url but because it integrates with pathauto you can see it up with the paths you need.
testing the module on a test site should answer your questions.
Otherwise you will need a custom module AFAICT
Code snippet
Here's what I came up with to build breadcumbs from urls -- this helps when you have lots of nodes that indexed in a view or taxonomy page, but not actually associated with a menu item.
Add this to your template.php (check first if your theme already has a breadcrumb function, if so, replace the code in it).
(disclaimer -- this is the first code I've written in years!)
function YOURTHEMENAM_breadcrumb($breadcrumb) {
if (!empty($breadcrumb) ) {
$path = explode('/', $_SERVER['REQUEST_URI']);
//compare breadcrumb to path to see if we have to make up a crumb
if(sizeof($path) > (sizeof($breadcrumb) + 1)){
$i = 1;
$link_path = $path[$i];
while ($i < (sizeof($path) - 1)){
$link_text = str_replace('-',' ', $path[$i]);
//can add more clean-up/special cases here
$breadcrumb[] = l(ucwords($link_text), $link_path);
++$i;
$link_path.='/'.$path[$i];
}
}
}
return implode(' > ', $breadcrumb);
}
A similar method
Another (very similar) method is detailed here: http://drupal.org/node/698666