I want to create a tag cloud based on tags I assign to products. The idea being the more occurances of the tag the bigger the text in the tag cloud.
I have the code written which returns the tag text against the number of occurances but I'm not sure how to convert the weighting to a css class.
eg.
microwave 9 occurances
tv 22 occurances
pc 3 occurances
hi-fi 16 occurances
hdmi 1 occurance
I have created 8 css classes:
.size1 { font-size 8pt; }
.size2 { font-size 9pt; }
.size3 { font-size 10pt; }
etc.
so say I have 10 tags ranging from occurances 1 to 30 how could I assign them to my css classes. I also need this flexible so I could have any number of tags with any range of occurances.
I am using php as the scripting language so I don't mind if the code is done in that or javascript / jquery which I am also using on my site
Can anyone give me any help or point me to a tutorial or code snippet which doe what I'm after?