TagCloud Maker Class 1.0 review
DownloadTagCloud Maker Class is a class that takes a single dimensional array of terms and outputs a piece of HTML with each term wrapped in
|
|
TagCloud Maker Class is a class that takes a single dimensional array of terms and outputs a piece of HTML with each term wrapped in a span tag with an ID that you can define in your CSS.
TagCloud Maker Class script can be called either as an object or as a static class.
Check out the example page. The keywords from the sample page come from the last 30 entries of my blog. I'll admit I cheated and just open the database and pull them from there instead of trying to call my blog w/curl or fopen and parse it. (Although that would have been cooler.) I then ran each blog entry against Yahoo's Term Extraction API to get the terms. Then I pumped that array into my new TagCloud maker. The important code you can't see from the index.php is below.
require_once('TagCloud.php');
$x = TagCloud::fetch_cloud($thisArray,'...','tagcloud_','http://www.technorati.com/tags/%s');
$o = new TagCloud($thisArray,'...','tagcloud_','http://www.technorati.com/tags/%s',10,'weight',2);
$o->get_cloud();
$y = $o->output_cloud;
As you can see, I used 2 different methods of creating the 2 lists. The first is just calling the object::method statically with all the necessary parameters. This is by far the easiest way to use this class and unless you need something special, it's the way I recommend. The second way it to instantiate an object. I pass all the variables into the constructor but you could just as easily use the setters to set them all. (don't know why you would but hey, I spent an extra 15 minutes creating getters and setters so use them, by all means use them!)
TagCloud Maker Class 1.0 search tags