Example #1
0
    color:white !important;
    background-color: #FF0000;
}
.tagcloud a:active {
    border-width: 1px;
    color:white !important;
    background-color: #FFFB00;
}
.tagcloudElement {
    padding: 2px 5px;
    position: relative;
    vertical-align: middle;
}
<?php 
// Print out CSS
print $tagCloud->buildCSS();
?>
</style>
</head>
<body>
<p>This box shows a randomized tag cloud, hit reload to mix them up:</p>
<?php 
// Print out HTML
print $tagCloud->buildHTML();
// Show source, you don't need this line in your code, it's just for showing off
?>
<br/>
Take a look at the source:<br/>
<?php 
show_source(__FILE__);
?>
Example #2
0
$tags = new HTML_TagCloud($baseFontSize, $fontSizeRange);
// Prepare some items, without specifying the timestamp (this way they will get
//  the actual timestamp)
$name = 'a';
foreach (range(0, 15) as $i) {
    $arr[$i]['name'] = $name;
    $arr[$i]['url'] = '#';
    $arr[$i]['count'] = $i;
    $name++;
}
// Submit the prepared items to the TagCloud
$tags->addElements($arr);
$tags->addElement('H', '#', 16);
$tags->addElement('P', '#', 18);
// Get the CSS part only
$css = $tags->buildCSS();
// Get the HTML part only
$taghtml = $tags->buildHTML();
// Now return a HTML page and display the CSS-part and the HTML-part in
//  separated positions
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>My first Tag Cloud</title>
<style type="text/css">
<?php 
// Print CSS-part of the TagCloud
print $css;
?>