Edited By

Shoma Suzuki

Usage examples

Usage examples – Using HTML_TagCloud.

Generate HTML and CSS separately

HTML_TagCloud creates HTML and CSS. The HTML is a simple list, decorated by CSS. You are able to output HTML and CSS separately.

output HTML and CSS separately

<?php
// CSS part only
$css $tags->buildCSS();
// html part only
$taghtml $tags->buildHTML();
?>

The HTML output depends on the tag data that have been added via addElement(), but the CSS output is static. You can use this package's CSS output statically.

Modify the decoration of the tag

It is possible to modify the colors used by the CSS. You need to define your own class which extends HTML_TagCloud and override color and size properties.

Decoration example

<?php
class MyTags extends HTML_TagCloud
{
    protected 
$epocLevel = array(
        array(
            
'earliest' => array(
                
'link'    => 'ffdfdf',
                
'visited' => 'ffdfdf',
                
'hover'   => 'ffdfdf',
                
'active'  => 'ffdfdf',
            ),
        ),
        array(
            
'earlier' => array(
                
'link'    => 'ff7f7f',
                
'visited' => 'ff7f7f',
                
'hover'   => 'ff7f7f',
                
'active'  => 'ff7f7f',
            ), 
        ),
        array(
            
'previous' => array(
                
'link'    => 'ff7f7f',
                
'visited' => 'ff7f7f',
                
'hover'   => 'ff7f7f',
                
'active'  => 'ff7f7f',
            ), 
        ),
        array(
            
'recent' => array(
                
'link'    => 'ff4f4f',
                
'visited' => 'ff4f4f',
                
'hover'   => 'ff4f4f',
                
'active'  => 'ff4f4f',
            ), 
        ),
        array(
            
'later' => array(
                
'link'    => 'ff1f1f',
                
'visited' => 'ff1f1f',
                
'hover'   => 'ff1f1f',
                
'active'  => 'ff1f1f',
            ),
        ),
        array(
            
'latest' => array(
                
'link'    => 'ff0000',
                
'visited' => 'ff0000',
                
'hover'   => 'ff0000',
                
'active'  => 'ff0000',
            ),
        ),
    );
    protected 
$size_suffix 'pt';
    protected 
$fontsizerange 0;
    protected 
$basefontsize 12;
}
?>

Omit timeline feature

If you don't want to add timeline information and have the color changing accordingly, just omit the fourth parameter to addElement(). When doing this, the current time is set.

Omitting the timeline

<?php
$tags
->addElement('PHP','http://www.php.net'39);
?>
Introduction to HTML_TagCloud. (Previous) HTML_Template_Flexy (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.