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

jazzslider - May 6, 2009 - 17:49
Status:needs review» patch (to be ported)

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!

AttachmentSize
tagadelic.patch 878 bytes

#2

jazzslider - May 6, 2009 - 17:50
Status:patch (to be ported)» needs review

Sorry, misunderstood the status descriptions; changing back to needs review.

#3

Bèr Kessels - May 13, 2009 - 17:21
Status:needs review» needs work

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

nirad - May 26, 2009 - 20:44

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

heartsutra - May 30, 2009 - 02:46

Patch worked fine for me on Tagadelic 6.x-1.2 and Drupal 6.12. Thanks!

#6

momper - June 4, 2009 - 06:09

subscribe

#7

jazzslider - June 18, 2009 - 16:05

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:

  1. Create a taxonomy vocabulary and assign a few terms to a few posts.
  2. Enable the block for that taxonomy vocabulary.
  3. Install tagadelic 6.x-1.x-dev. At this point, the block should show appropriately-weighted terms.
  4. Install taxonomy_redirect 6.x-1.x-dev. At this point, you might still see appropriately weighted terms in the block.
  5. Go to the taxonomy_redirect config page (it's under "Site building") and set up a taxonomy redirect entry. Once you've done so, the terms in the block will no longer be correctly weighted.
  6. Disable taxonomy_redirect and the problem goes away.

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.

AttachmentSize
tagadelic.patch 819 bytes

#8

dawansv - July 3, 2009 - 00:56

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

peashooter - July 18, 2009 - 08:47

legends. thanks for this patch!

#10

doublejosh - July 27, 2009 - 08:19

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.

<?php
print l($term->name, taxonomy_term_path($term)); // = success
// vs.
print l($term->name, 'taxonomy/term/$term->tid'); // = fail
?>

#11

foxtrotcharlie - July 30, 2009 - 07:29

Tested, and it sorts out the issue for me.

#12

xenoterracide - August 12, 2009 - 02:13

I don't see any cc option so... just CC-ing myself.

#13

sjf - September 15, 2009 - 06:11
Status:needs work» reviewed & tested by the community

Patch works for me. Thanks.

#14

Bèr Kessels - September 15, 2009 - 20:57
Status:reviewed & tested by the community» fixed

committed to github. Will appear in next release.

#15

System Message - September 29, 2009 - 21:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#16

elyobo - November 1, 2009 - 11:39

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

Justin W Freeman - November 14, 2009 - 06:42

FYI,
#620136: Breaks Tagadelic Weighting has now been fixed in taxonomy_redirect also

#18

hedac - November 27, 2009 - 06:27

thank you. patch working with 1.40.2.10 too

but.. should I patch also taxonomy redirect?

 
 

Drupal is a registered trademark of Dries Buytaert.