Под редакцией

Shoma Suzuki

Introduction

Introduction – Introduction to HTML_TagCloud.

Overview

This package can be used to generate tag coulds in HTML and CSS. A tag cloud is an visual representation of list of so-called "tags" or keywords, that do have a different font size depending on how often they occur on the page/blog.

More information on tag clouds is available in Wikipedia.

This package does not only visualize frequency, but also timeline infomation. The newer the tag is, the deeper its color will be; older tags will have a lighter color.

Simple usage example

Basic example

<?php
require_once 'HTML/TagCloud.php';

$tags = new HTML_TagCloud();
// add Elements
$tags->addElement('PHP'       ,'http://www.php.net'  39strtotime('-1 day'));
$tags->addElement('XML'       ,'http://www.xml.org'  21strtotime('-2 week'));
$tags->addElement('Perl'      ,'http://www.xml.org'  15strtotime('-1 month'));
$tags->addElement('PEAR'      ,'http://pear.php.net' 32time());
$tags->addElement('MySQL'     ,'http://www.mysql.com'10strtotime('-2 day'));
$tags->addElement('PostgreSQL','http://pgsql.com'    ,  6strtotime('-3 week'));
// output HTML and CSS
print $tags->buildALL();
?>

The above example code creates a tag cloud containing five items. The tag used most often is "PHP"; it will appear in the largest font. The tag used latest is"PEAR", it is in the deepest color. Tags are sorted by alphabetically, and escaped in HTML.

    Поддержать сайт на родительском проекте КГБ