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

CommentFileSizeAuthor
#7 tagadelic.patch819 bytesjazzslider
#1 tagadelic.patch878 bytesjazzslider

Comments

jazzslider’s picture

Status: Needs review » Patch (to be ported)
StatusFileSize
new878 bytes

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!

jazzslider’s picture

Status: Patch (to be ported) » Needs review

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

Bèr Kessels’s picture

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}".

nirad’s picture

I am using taxonomy redirect and I had the same problem and I can confirm that this patch fixed it on version 1.2.

citronica’s picture

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

momper’s picture

subscribe

jazzslider’s picture

StatusFileSize
new819 bytes

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.

dawansv’s picture

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>
halfiranian’s picture

legends. thanks for this patch!

doublejosh’s picture

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.

print l($term->name, taxonomy_term_path($term)); // = success
// vs.
print l($term->name, 'taxonomy/term/$term->tid'); // = fail
foxtrotcharlie’s picture

Tested, and it sorts out the issue for me.

xenoterracide’s picture

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

sjf’s picture

Status: Needs work » Reviewed & tested by the community

Patch works for me. Thanks.

Bèr Kessels’s picture

Status: Reviewed & tested by the community » Fixed

committed to github. Will appear in next release.

Status: Fixed » Closed (fixed)

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

elyobo’s picture

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.

agileware’s picture

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

hedac’s picture

thank you. patch working with 1.40.2.10 too

but.. should I patch also taxonomy redirect?

mstrelan’s picture

+1

stg11’s picture

#7 patch works please put in next release. thanks

devkinetic’s picture

Status: Closed (fixed) » Reviewed & tested by the community

I bumped into this issue today and can confirm the patch in #7 works as intended.

I will also note that this was approved by the community, marked as fixed, and indicated that the patch was implemented into the branch back in 2009. I tried 1.3, 1.4-rc1, & 1.x-dev as of 9/13/12 and this patch has still not been implemented. I'm sure this was an oversight, and hope my gentle nudge will help out others running into this.

Bèr Kessels’s picture

Status: Reviewed & tested by the community » Fixed

It was committed: https://github.com/berkes/tagadelic/blob/6.x-1.x/tagadelic.module#L395

The 7.x-branch does not contain this, but that is not released anyway (aka: it needs work still).

Status: Fixed » Closed (fixed)

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