Hey guys, I'm using the following snippet to include tags in my page.tpl.php file (not in a block)

drupal_set_html_head('<style type="text/css">@import url('.drupal_get_path('module','tagadelic').'/tagadelic.css);</style>');
$vocs[] = 3; //  id of the vocabulary of which you want to display a tag cloud
$output = theme('tagadelic_weighted',tagadelic_get_weighted_tags($vocs));
print $output;

is it possible to add some code there to make it respond to SORT order preferences I set in my module. Right now it only sorts by WEIGTH, but I would prefer sorting by title or random...

when I use this code in a block (I don't want to do that), the ordering works...
what's the difference with placing this code snippet just in my page.tpl.php ?

Comments

Bèr Kessels’s picture

tagadelic_get_weighted_tags($vocs) does the sorting for you. The order is configurable in the interface.

---
Professional | Personal
| Sympal: Development and Hosting

jorre’s picture

that's my point

the sorting doesn't happen when using the code snippet above directly in page.tpl.php
if I put the code in a block, then the sorting DOES work...

Pakfriet.be
Uzegt.be

Bèr Kessels’s picture

Your snippet calls the tagadelic_get_weighted_tags function. In that function we do the ordering. So it should be ordered fine, no matter where you use your snippet.

---
Professional | Personal
| Sympal: Development and Hosting

jorre’s picture

well, as you can see on www.uzegt.be the tagadelic cloud isn't really ordered randomly or by title, but always by weigth. I have my tagadelic preferences set to RANDOM though . . .

so my guess is, there is a difference between putting this code in a block (then the sorting DOES work) and putting the code directly in page.tpl.php (there, voc. terms are shown, but not sorted the way they should...)

Pakfriet.be
Uzegt.be

Bèr Kessels’s picture

what versions are you using?

---
Professional | Personal
| Sympal: Development and Hosting

jorre’s picture

drupal 4.7.4

Pakfriet.be
Uzegt.be

Bèr Kessels’s picture

No, I mean what version of tagadelic :)

---
Professional | Personal
| Sympal: Development and Hosting

jorre’s picture

ah sorry ;)

Can't seem to find a version in the module files, but in my nl.po file I find this:

tagadelic.module,v 1.19

I downloaded the latest version about one month ago.

but like I said, sorting works in a block, just not outside a block

try pasting the code snippet in your page.tpl.php file, and see if sorting works?

Pakfriet.be
Uzegt.be

jorre’s picture

Did somebody test it?

pasting the code in page.tpl.php ? (of course, adjusting the voc number)

I really hope to find a way to fix this. tagadelic clouds ROCK when ordered by random!

Pakfriet.be
Uzegt.be

TheJohnny’s picture

I get the same problem with using the code with front_page module (that means outside block - it works fine in a block) :-(

jorre’s picture

nobody taking a shot here?

Pakfriet.be
Uzegt.be

jorre’s picture

I'm giving up hopes here... :-)

Pakfriet.be
Uzegt.be

TheJohnny’s picture

Try this:

$tagcloud = "";
drupal_set_html_head('<style type="text/css">@import url('.drupal_get_path('module','tagadelic').'/tagadelic.css);</style>');
$vocs[] = 2; //  id of the vocabulary of which you want to display a tag cloud
$tagcloud = theme('tagadelic_weighted',tagadelic_sort_tags(tagadelic_get_weighted_tags($vocs)));
print $tagcloud;

It seems you need to use tagadelic_sort_tags function with the code.

RegionalTrend

jorre’s picture

thanks a bunch! that seems to work!

Pakfriet.be
Uzegt.be

artatac’s picture

Works really well - thanks. I would like to use this on my home page ie here is a cloud with ALL terms. But I also have mainsections in my site that I would like to nave clouds relating just to that section eg Education section something like

$vocs = array(1,2,3) + types/education;

is this possible?

I am trying to avoid each dept/section having its own vocabulary as occasionaly it might be relevant for one dept to use another depts term

Regards

Joe

rhrueda’s picture

I need to show in a block all the terms of the taxonomy, not only the terms of one vocabulary. Does this code do this? http://drupal.org/node/100613#comment-179325 . Where do I have to place it?

-----------edited----------

I´ve created a new taxonomy vocabulary "tag-cloud" asocciated to the content types I want to add tags. But I can see the title of the block, not the tags. However, in the "more tags" link, the tags appear. ¿Why can't I see the tags in the block?

Thanks!