Tags sizes not shown when used with taxonomy redirect
Edlund - February 22, 2009 - 14:12
| Project: | Tagadelic |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I have a somewhat odd error, which means that whenever I have a tag cloud which is redirected with the taxonomy_redirect module, all tags are rendered with the class "level0"
I can follow the code all the way through, and the level shows correctly in the term object. But whenever it is put through the theming function
$output .= l($term->name, taxonomy_term_path($term), array('attributes' => array('class' => "tagadelic level$term->weight", 'rel' => 'tag'))) ." \n";it suddenly turns to zero. For the tag clouds which are not redirected it works fine.
I have also found a workaround, so changing the line from the above to:
$weight = $term->weight;
$output .= l($term->name, taxonomy_term_path($term), array('attributes' => array('class' => "tagadelic level$weight", 'rel' => 'tag'))) ." \n";makes it render correctly. I am not sure this is the right way to fix it, nor am I exactly sure why it fails. It might be the php implementation? If anyone can come up with an explanation I would love to hear it.
/Edlund

#1
I've gone ahead and posted a patch including the fix mentioned by @Edlund. Tested in combination with taxonomy_redirect, and it works perfectly.
Note that my patch doesn't include anything that @Edlund didn't already mentioned; I just figured submitting a formal patch might help speed along the inclusion of this fix into the next release. Hope this helps!
#2
Sorry, misunderstood the status descriptions; changing back to needs review.
#3
patch fails against most recent 6.x version. We committed some other patches that conflict with this one, sorry. Please reroll.
Furthermore: I cannot see what taxonomy_redirect module has to do with this patch. The patch makes sense for certain php-versions that behave different on parsing on variables in "".
Alternative is to put {} around the variable: "foo term{$term->weight}".
#4
I am using taxonomy redirect and I had the same problem and I can confirm that this patch fixed it on version 1.2.
#5
Patch worked fine for me on Tagadelic 6.x-1.2 and Drupal 6.12. Thanks!
#6
subscribe
#7
Hello!
Confirmed that the issue still exists with latest dev version of tagadelic in combination with latest dev version of taxonomy_redirect. Not sure why installing taxonomy_redirect makes a difference, but it does…to reproduce, do the following:
Using {} around the variable as suggested does not resolve the problem, even though it should (believe me, it was the first thing I tried). The only available resolution appears to be to assign the value of $term->weight to a separate variable prior to string interpolation, as in the patch.
As requested, I have updated the patch to reflect the latest dev version of tagadelic.
#8
I confirm similar problem here, also fixed by the patch.
I say similar because the symptoms are a bit different than described by the original poster. For one, all tags seem to be affected when taxonomy redirect is active, not just redirected vocabularies. Some vocabularies revert to 0 on all tags but not all. Other vocabularies get wrong, seemingly random levels assigned.
Here is an example (before patch applied of course) to show the erroneous levels:
Series without taxonomy_redirect module (turned off)-- CORRECT levels:
<a class="tagadelic level6" rel="tag" href="/taxonomy/term/1">article</a><a class="tagadelic level3" rel="tag" href="/taxonomy/term/5">caselet/profile</a>
<a class="tagadelic level6" rel="tag" href="/taxonomy/term/3">case study</a>
<a class="tagadelic level1" rel="tag" href="/taxonomy/term/6">interview/panel</a>
<a class="tagadelic level3" rel="tag" href="/taxonomy/term/8">model/methodology</a>
<a class="tagadelic level6" rel="tag" href="/taxonomy/term/9">paper/publication</a>
<a class="tagadelic level4" rel="tag" href="/taxonomy/term/10">presentation</a>
<a class="tagadelic level5" rel="tag" href="/taxonomy/term/13">report</a>
<a class="tagadelic level5" rel="tag" href="/taxonomy/term/11">template/sample</a>
<a class="tagadelic level6" rel="tag" href="/taxonomy/term/15">toolkit</a>
Same series with taxonomy_redirect module turned on -- WRONG seemingly random levels:
<a class="tagadelic level0" rel="tag" href="/taxonomy/term/1">article</a><a class="tagadelic level3" rel="tag" href="/taxonomy/term/5">caselet/profile</a>
<a class="tagadelic level1" rel="tag" href="/taxonomy/term/3">case study</a>
<a class="tagadelic level4" rel="tag" href="/taxonomy/term/6">interview/panel</a>
<a class="tagadelic level5" rel="tag" href="/taxonomy/term/8">model/methodology</a>
<a class="tagadelic level6" rel="tag" href="/taxonomy/term/9">paper/publication</a>
<a class="tagadelic level7" rel="tag" href="/taxonomy/term/10">presentation</a>
<a class="tagadelic level10" rel="tag" href="/taxonomy/term/13">report</a>
<a class="tagadelic level8" rel="tag" href="/taxonomy/term/11">template/sample</a>
<a class="tagadelic level11" rel="tag" href="/taxonomy/term/15">toolkit</a>
#9
legends. thanks for this patch!
#10
Thanks, this thread also showed me how to properly create a link to a term page so that taxonomy redirect can do it's job when I'm manually printing links.
<?phpprint l($term->name, taxonomy_term_path($term)); // = success
// vs.
print l($term->name, 'taxonomy/term/$term->tid'); // = fail
?>
#11
Tested, and it sorts out the issue for me.
#12
I don't see any cc option so... just CC-ing myself.
#13
Patch works for me. Thanks.
#14
committed to github. Will appear in next release.
#15
Automatically closed -- issue fixed for 2 weeks with no activity.
#16
FYI, I submitted this as a bug to taxonomy_redirect before coming across this - http://drupal.org/node/620136 - I'll leave it open, as I still think that taxonomy_redirect shouldn't be messing with the values in the first place.
#17
FYI,
#620136: Breaks Tagadelic Weighting has now been fixed in taxonomy_redirect also
#18
thank you. patch working with 1.40.2.10 too
but.. should I patch also taxonomy redirect?