Lyo Kato > HTML-TagCloud-Extended-0.10 > HTML::TagCloud::Extended

Download:
HTML-TagCloud-Extended-0.10.tar.gz

Dependencies

Annotate this POD (1)

View/Report Bugs
Module Version: 0.10   Source  

NAME ^

HTML::TagCloud::Extended - HTML::TagCloud extension

SYNOPSIS ^

    use HTML::TagCloud::Extended;

    my $cloud = HTML::TagCloud::Extended->new();
    $cloud->add($tag1, $url1, $count1, $timestamp1);
    $cloud->add($tag2, $url2, $count2, $timestamp2);
    $cloud->add($tag3, $url3, $count3, $timestamp3);

    my $html = $cloud->html_and_css( {
        order_by => 'count_desc',
        limit    => 20,
    } );

    print $html;

DESCRIPTION ^

This is extension of HTML::TagCloud.

This module allows you to register timestamp with tags. And color of tags will be changed according to it's timestamp.

Now, this doesn't depend on HTML::TagCloud.

TIMESTAMP ^

When you call 'add()' method, set timestamp as last argument.

    $cloud->add('perl','http://www.perl.org/', 20, '2005-07-15 00:00:00');

FORMAT

follow three types of format are allowed.

2005-07-15 00:00:00
2005/07/15 00:00:00
20050715000000

COLORS ^

This module chooses color from follow four types according to tag's timestamp.

earliest
earlier
later
latest

You needn't to set colors because the default colors are set already.

But when you want to set colors by yourself, of course, you can.

    my $cloud = HTML::TagCloud::Extended->new;

    $cloud->colors->set(
        earliest => '#000000',
    );

    $cloud->colors->set(
        earlier => '#333333',
        later   => '#999999',
        latest  => '#cccccc',
   );

    # or, you can set color for each attribute
    $cloud->colors->set(
        earliest => {
            link    => '#000000',
            hover   => '#CCCCCC',
            visited => '#333333',
            active  => '#666666',
        },
    );

LIMITTING ^

When you want to limit the amount of tags, 'html()', html_and_css()' need second argument as hash reference.

    $cloud->html_and_css( { order_by => 'timestamp_desc' , limit => 20 } );

SORTING TYPE

default is 'name'

name
name_desc
count
count_desc
timestamp
timestamp_desc

OTHER FEATURES ^

use_hot_color

set by size

    my $cloud = HTML::TagCloud::Extended->new(
        use_hot_color => 'size',
        hot_tags_size => 24,
    );

    # or set with accessor method

    my $cloud = HTML::TagCloud::Extended->new;

    $cloud->use_hot_color('size');
    $cloud->hot_tags_size(24);

Then, tags that's size is over 24 applys color for 'hot'. If you omit 'hot_tags_size', it'll be proper number automatically.

set by name

    my $cloud = HTML::TagCloud::Extended->new(
        use_hot_color => 'name',
        hot_tags_name => [ 'perl', 'ruby', 'python' ],
    );

    # or set with accessor method

    my $cloud = HTML::TagCloud::Extended->new;

    $cloud->use_hot_color('name');
    $cloud->hot_tags_name('perl', 'ruby', 'puthon');

You can alse change colors for 'hot' by yourself.

    $cloud->colors->set( hot => '#ff9900' );

    # or

    $cloud->colors->set(
        hot => {
            link    => '#000000',
            hover   => '#CCCCCC',
            visited => '#333333',
            active  => '#666666',
        },
    );
base_font_size

default size is 24

    # set as constructor's argument
    my $cloud = HTML::TagCloud::Extended->new(
        base_font_size => 30,
    );

    # or you can use accessor.
    $cloud->base_font_size(30);
size_suffix

default suffix is 'px'

You can choose it from [ mm cm in pt pc px ].

    # set as constructor's argument
    my $cloud = HTML::TagCloud::Extended->new(
        size_suffix => 'pt',
    );

    # or you can use accessor.
    $cloud->size_suffix('cm');
font_size_range

defualt range is 12.

    my $cloud = HTML::TagCloud::Extended->new(
        font_size_range => 10
    );

    $cloud->font_size_range(10);
css_class

default name is 'tagcloud'

    my $cloud = HTML::TagCloud::Extended->new(
        css_class => 'mycloud',
    ); 

    $cloud->css_class('mycloud');

SEE ALSO ^

HTML::TagCloud

AUTHOR ^

Lyo Kato <lyo.kato@gmail.com>

COPYRIGHT AND LICENSE ^

This library is free software. You can redistribute it and/or modify it under the same terms as perl itself.

syntax highlighting: