Tutorial: How-To make a Tag Cloud using PHP & MySQL
How to make Tag Cloud using PHP & MySQL
Tag Clouds are pretty common now-a-days in almost all the web 2.0 company sites. Be it Technorati, Zoom CLouds, WordPress, Blogger etc.
Why Tag Clouds are important?
Pretty much for the same reasoon: Appealing Users.
On seeing all these even I have decided to introduce the Tag Cloud feature in our project.
Now, the very important question: How do we code to create a Tag Cloud using PHP & MySql?
Here I will show you how to code it.
First the logic:
1. Collect all the tags & Count{how-many times it has been tagged} from DB{MySQL}
2. Put them into a array {PHP}
3. Calculate the maximum and minimum count of the tags used
4. Now, loop through each tag and just change the size of the font.
5. Define a simple class say “wrapper” which will contain the tag clouds
6. Call the function to generate the tag cloud. {Javascript}
Now, since Im falling short of time, so I will cut the crap and you guys take the code directly.
Yes, a word from me, I will surely update it as time permits in full detail.
Cheerz
Srinix
PS: Download the Code here: Tag Cloud Code
If you are reading article, you might also be interested in the PHP and Scriptaculous Book I have authored.
The book gives you insights about effects, drag-n-drop, slideshows, applications, auto-completion, in-place editing and more. Complete code snippets and explanations.
CHECK out and BUY the PHP and Script.aculo.us book at Packt official site
http://www.packtpub.com/php-and-script-aculo-us-web-2-0-application-interface/book
55 responses to “Tutorial: How-To make a Tag Cloud using PHP & MySQL”
Trackbacks / Pingbacks
- June 5, 2007 -
- November 6, 2007 -
Srinix,
Fascinating stuff!
Haven’t got a clue what it’s about, but wow. I’m impressed.
Like the quote of the day; That I can cope with.
winslie
aaaagh mahn
@Winslie
If you can scroll down here in blog, towards right pane you can see the mash-up of all the tags.
Thats wht is a Tag-Cloud. Its eaiser to naviagte using Tag-Cloud.
Cheerz
Sridhar
just for info:
for all you PEAR users out there, there is a PEAR package that can help in creating your tag cloud.
you can find it here:
http://pear.php.net/package/HTML_TagCloud
have fun!
@Cornholio
Thanks a lot for sharing with us.
PEAR is no doubt one of the best libraries.
Cheerz
Sridhar
i not download.The link died
@srinix:
well, yes, it offers a lot of interesting stuff, although many PEAR packages suffer from one great disadvantage: size. extensive use of PEAR can, when not implemented wisely, cause great load times and therefore belittle the advantages of external classes and scripting.
is this for the online one or the 2.2 version?
Greetings!..
per3va2cho4k per3va2cho4k
interesting thank you…
breast augmentation new york city san diego breast augmentation
Thank you for your site.
alaska salmon fishing+ kenai
Thank you!
fly fishing+ lodges montana
information …
alaska salmon fishing+ charter
interesting thank you…
wasilla alaska fishing+ lodge
interesting thank you…
alaska en fishing+ language salmon
Hi,
Great script!
I have a question, how can I add an external URL on each tag ?
Like word-cloud script.
Thank you.
Alex,
Yes u can add external URL as well 🙂
Could you please tell me how ?
Thank you.
big free movie pizza sausage
big free movie pizza sausage
Thanks. How do I include a URL to do a custom Google search with the cloud?
Where it is possible to buy the ? It is very necessary!
adult thick cocks http://adinox.funpic.org
gluten wheat free diet
gluten wheat free diet
It is necessary to search correctly. By the way, who to share the helpful information? Where it is possible to find?
tramadol
zone diet food pyramid
zone diet food pyramid
buy 30mg phentermine no prescriptions
buy 30mg phentermine no prescriptions
buy 30mg phentermine no prescriptions
buy 30mg phentermine no prescriptions
buy 30mg phentermine no prescriptions
buy 30mg phentermine no prescriptions
enterprise car renta
enterprise car renta
womans
womans
phentermine
phentermine
phentermine uk no prescriptions
phentermine uk no prescriptions
advantage car rental denver airport
advantage car rental denver airport
aw
aw
Follow these guidelines and you will build that new home with little, or no, problems. alcoa siding can help…
Na2011b11backs
m
Na2011b11backs
s
fghjnffssefxc
holiday
how i can print many words from full text (db)
example:
if i have this text: Enter the key you see above
and want display it as tag like
enter,the,key,you,see,above
how to do it
g
g
Thanks, the attached coding was exactly what I was looking for…
I get non stop errors
Here is a nice script for a design tag cloud :
http://www.ilikeyoutube.com/cloud/
Enjoy
hot
hot
best
best
Nice article… funny thing, these tag-clouds.
Gonna check it out right away!
Very good this script 😉
Multi Art’s Informatica
Hmmm… word clouds look nice, but I can not lose the feeling that they use up too much screen space.
Any ideas how to “compress” it a bit?
Hi,
Can you help me …
I wish to limit number of tags for displey …How can I do theat …
Thank you for help …
Hi Stephen,
If you don’t mind, a high school biology teacher (me) needs your help for this tag cloud script. The linking part is working just fine. The problem I am having is that the script is not counting the number of tags I have for each row entry. It is saying : returned count of 0. The other problem is the comma separated tags name, name2, etc. for each bookmark’s entry tags are tag clouded as a group instead of separate words.
I have been searching on the Web for three days and cannot find a solution for these questions.
Is this script suppose to count the tags and put that information back into the dbase and then output it to the tag cloud? or Is this suppose be happening another way, say like when a person post a new entry with added tags?
How are you implementing script wise for the tag cloud in the right margin on this page? I can see that you are getting the count numbers.
Sincerely,
Charles
I think I’ll implement this om my site!
car rental service prices have risen this year. i am saving to buy my one car ,;”
how can i download this code file?
your code is blocked!