I have modified the tagadelic slightly to add a small feature. In the current version, the following two things have the same results:
http://yoursite.com/tagadelic
http://yoursite.com/tagadelic/chunk
The result is basically all tags in all categories get displayed in one cloud with the same default color. In my modified version,
will display all tags in all categories in different colors (customizable by you in the tagadelic.css file). The second difference is that the weights of terms in different categories are independent, in constrast to http://yoursite.com/tagedelic/chunk, which would assign weights to all terms in all categories as though they belong to one category.
I think the different coloring scheme together with the independent weight assignment make more sense in the Drupal system that has different categories, which intuitively should be treated and displayed differently (when shown together in one cloud).
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | tagadelic_1.patch | 2.99 KB | vph |
| #6 | tagadelic_0.patch | 3.09 KB | vph |
| #1 | tagadelic.module | 8.6 KB | vph |
| tagadelic.css | 2.36 KB | vph |
Comments
Comment #1
vph commentedattached is the modified module
Comment #2
vph commentedthe style file should go together with the modifed module. If you have more than three vocabularies, just add new entries (with new colors) to the style file. The attached style file has examples of new entries. Basically, the new entries should have suffixes 4,5,6, etc.
Comment #3
Bèr Kessels commentedplease provide a proper patch: see drupal.org/diffandpatch
Comment #4
Bèr Kessels commentedreviewing the code:
I diskike what you do. tagadelic_page_all() is nearly an exact copy of tagadelic_page_chunk() that is bad coding practice.
Can you not just add a parameter to theme('box' ) in *all views* to give them classes and or IDs?
Comment #5
vph commentedHi, thanks for reviewing the code. Even though I can program, I'm not too good with php and Drupal's API. What I wanted to do here is to implement the "two-color" feature without modifying too much of your codes and maintain compability with your version. This is why I almost duplicate the page_chunk() function.
This function here simply separates all terms of a vocabulary and assign each term a different color code and make use of your function get_weighted_tags at the same time. If you can simplify this, please do so.
Thanks.
Comment #6
vph commentedHere's the patch. You can look at it and see all the differences.
Comment #7
Bèr Kessels commentedA very very small patch like this should work:
$output .= l($term->name,"taxonomy/term/$term->tid", array('class'=>"tagadelic level$term->weight $term[vid]"))Please make that a patch and test!
Comment #8
vph commentedNow, I see what you mean. And i thought about doing the same thing too. That is, instead of assigning a color code (a number) to each term, simply use its term_id. If the term_id's start from 1 to K, then they will match the style tags easily; note that the style tags are numbered from 1 to K. However, there is no warranty that the term_id's will start from 1, consecutively to K, especially true when people delete and add new terms. In order for this to work, you must edit the style.css file to make sure that the numbering of style tags matches the numbering of term_id, which is a pain and not very scalable.
That's why I decided to assign consecutive color numbers to each term, ignoring its term_id, to ensure that the number of style tags can be easily matched.
I also took your comment to reuse the function page_chunk instead of duplicating the code. Included is the LATEST PATCH. Please use that version, if you wish.
Regards.
Comment #9
Bèr Kessels commentedyour current solution is still ugly.
* you dont need an additional callback function
* no need for changing the menu
* please use sbuclasses. not levelX but rather level1 X
* Please *only* add a vocabulary-vid to ALL the links. Its by far the simplest. that way we can style *all* chunks, not only one.
Comment #10
vph commentedLast night, I modded this module quite extensively to create something that works for me, and I maybe for a few others too. I took several comments from you, and implemented them, but for the latest version v18, i.e. only works with Drupal 4.7.
Basically, I added a mysql table to store a customized color for each vocab. I also added two options in the settings, which allow users to choose or not choose to customize the coloring scheme, and also to choose if the vocabularies will be weighted independently from one another (as discussed above). I intend to add one more feature.
Now, these things are only important if you want to fine tune the look of different vocabularies (especially when displayed in group together), instead of treating all vocabs as though they are the same by using the same color and weight scale. Although these things satisfy my needs, I don't want to still call it tagadelic as it is not exactly the original version, out of respect for the your creation. But if you want to use what I have done, I'll be happy to put it up for you to examine.
Btw, why not call it something liek taxonomy_cloud ? Just curious.
Comment #11
Bèr Kessels commentedWe need to add a voc id to each class. That way a stylesheet can give different colors or styles to tags in different vocs.
Comment #12
Bèr Kessels commentedComment #13
doublejosh commentedIn order to match the system already in place on taxonomy I recommend also adding this...
array('class'=>"tagadelic level$term->weight taxonomy_term_$term->tid", 'rel'=>'tag'))
taxonomy_term_TERM-ID is the standard notation from what I understand.
thanks for the vid suggestions as well!!!
Comment #14
Bèr Kessels commentedComment #15
Bèr Kessels commentedClosing "needs work" that has been open for a long time, without anyone working on it.