By tajinder.minhas on
I was going through the various breadcrumb modules as well as the core drupal function drupal_set_breadcrumb but couldn't find the right solution for me.
I have created my own function so maybe it can help someone else also in drupal 6. This function will not use the drupal breadcrumb functionality instead it will work according to the path of the page i.e. url.
Write the following function in template.php
function get_breadcrumb(){
global $base_url;
$breadcrumb = array();
$path = $_SERVER['REQUEST_URI'];
$firstpath = explode('?',$path);
$paths = explode('/',$firstpath[0]);
$actualpath = '';
$last = end($paths);
foreach($paths as $test){
$actualpath .= $test. '/';
if($test == $last) {
$breadcrumb[] = t(ucwords(str_replace("-"," ",$test)));
}
else {
$breadcrumb[] = l(ucwords(str_replace("-"," ",$test)), rtrim($base_url.$actualpath, "/"));
}
}
$breadcrumb[0] = l('Home','<front>');
return $breadcrumb;
}
Call the above function in page.tpl.php as following
$path = get_breadcrumb();
foreach($path as $crumb){
$bread .= $crumb . " > ";
}
$breadc = substr($bread,0,-3);
print $breadc;
Comments
You posted your 'Topic' in a
You posted your 'Topic' in a deprecated forum.
The 'Deprecated' section of the forums
is intended as a library archive collection of old posts
and is not be seen by typical forum users.
Please "edit" this 'Topic', and change the 'Forum'
to one of the active ones.
I recommend the 'Forum' Post installation http://drupal.org/forum/22.
Good luck, and all the best.
All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *
Thanks
Thanks for the suggestion. I will post my code by creating a forum there
Regards
Tajinder Singh Minhas
Software Engineer
(SDG SIPL)