This section, which shows how to make tag clouds in PHP, is preceded by asection that covers the same material, but uses Perl. If you are more familiar withPerl, and haven't read that section, I suggest you read it first.
Now I'll show you how to make a Flickr-style tag cloud in PHP. In order to runthese scripts, you'll need some familiarity with PHP and access to a web serverthat supports PHP. PHP scripts are typically uploaded to the server using FTP, andthen tested by invoking them in a local web browser that can access the server.You can learn more about PHP by visiting the PHP web site: http://www.php.net/ .
There is one minor difference in the following scripts from the Perl scriptsdescribed in the previous section: In the Perl scripts, we saved the tag informationto a file and passed that file (via a command-line argument) to another script, makeTagCloud.pl, which generates the tag cloud. The PHP counterpart scripts willnot use this temporary file, but instead collect the tags directly into an array.Otherwise, these scripts mimic the functionality of the scripts we developed inPerl.
Most of this article is concerned with collecting tags and displaying them in theform of a tag cloud. I will assume that you have a source of tags or phrases. But tobegin with, we do need some raw data, so the scripts that count the tags will useweb sites that provide data we can use to build tag clouds.
When developing a general-purpose script, ...