Hi Nancy,
I was looking into the breadcrumb stuff again, related to: http://drupal.org/node/671568 with that I could change the Breadcrumb correctly in /taxonomy/term.
But I have another issue, thats why I start a new issue.
I use hierarchical_select, and this module gives the possibility to add a term and then the parent term is also shown.
But now in the breadcrumb I see the parent itself, and again the parent and subterm.
For instance I see: Home >> Weblinks >> Italy | Italy | Le Marche
So twice I see Italy!
Could you help me to only get the parents shown ones please?
I noticed googling myself that may be it is related to: http://drupal.org/node/217676 (taxonomy_get_parents_all() doesn't work correctly with multiple hierarchy terms).
In this code I saw you used taxonomy_get_parents_all. May be for now better to make a weblinks function, because until now it is not aranged in D6, something like underneath:
/**
* Implementation of weblinks_taxonomy_get_parents_all because of bug:http://drupal.org/node/217676
*/
function weblinks_taxonomy_get_parents_all($tid) {
$parents = array();
if ($term = taxonomy_term_load($tid)) {
$parents[] = $term;
$n = 0;
while ($n < count($parents)) {
if ($parent = taxonomy_get_parents($parents[$n]->tid)) {
$parents = array_merge($parents, $parent);
}
$n++;
}
}
Thanks a lot in advance for your reply.
Comments
Comment #1
summit commentedHi Nancy,
The proposed function is:
Unfortunately it can't work like this in D6..because of non existing taxonomy_term_load.
Comment #2
summit commentedI tried it with taxonomy_get_term (ancestor of taxonomy_term_load..) but still I got:
Home >> Weblinks >> Italy | Italy | La Marche
See function:
Comment #3
summit commentedHi Nancy with function function weblinks_view this is still not working!
Could you help me please to get this working.
You said Unfortunately it can't work like this in D6..because of non existing taxonomy_term_load.
Is this may now solveble, does anybody know how to deal with this?
greetings, Martijn
Code function:
Comment #4
summit commentedHi Nancy,
I saw there is a helper module: http://drupal.org/project/taxidermy in which there is the function:
taxidermy_taxonomy_term_load.
Would it be helpful to use this helper-module related to breadcrumb weblinks drupal 6?
greetings,
Martijn
Comment #5
Padmakani commentedfunction yourthemename_breadcrumb( $variables )
{
// init
$breadcrumb = $variables['breadcrumb'];
// taxonomy hierarchy
$hierarchy = array();
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)))
{
$tid = (int)arg(2);
$parents = taxonomy_get_parents_all($tid);
$parents = array_reverse($parents);
$breadcrumb = array();
$breadcrumb[] = l('Home', '/');
foreach( $parents as $k=>$v)
{
$breadcrumb[] = l($v->name, 'taxonomy/term/'. $v->tid);;
}
}
// rendering
if (!empty($breadcrumb))
{
$output = '
' . t('You are here') . '
';
$output .= '
';
return $output;
}
}
Comment #6
GStegemann commentedHi Nancy,
is this issue still relevant?
Comment #7
nancydruI don't know, but probably.
Comment #8
summit commentedHi,
If the code is unchanged..yes then it is still relevant!
Greetings, Martijn
Comment #9
GStegemann commentedOK. But the the strange thing is I cannot reproduce it.
On my test site the breadcrumb looks correct:
Home » Web Links » Automatisierungstechnik | FactoryLinkNothing is displayed twice. In what theme do you see the duplicates?
Comment #10
summit commentedHi,
So this problem is not on your site then: https://drupal.org/node/217676
I have very old code..maybe when I update all modules to latest versions, it isn;t happening anymore.
Unfortunately I do not have time for this on this particular site where this problem occurred..(my post is almost 4 years old where it occured..)
We are talking about Drupal 6 still yes?
Greetings, Martijn
Comment #11
GStegemann commentedNo, I don't see the problem. Yes, we are talking about Drupal 6. My test site is running under Drupal core 6.30 with up-to-date modules.
Gerhard