|
HTML::TagCloud::Extended - HTML::TagCloud extension |
HTML::TagCloud::Extended - HTML::TagCloud extension
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;
This is extension of the HTML::TagCloud manpage.
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 the HTML::TagCloud manpage.
When you call 'add()' method, set timestamp as last argument.
$cloud->add('perl','http://www.perl.org/', 20, '2005-07-15 00:00:00');
follow three types of format are allowed.
This module chooses color from follow four types according to tag's timestamp.
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',
},
);
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 } );
default is 'name'
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',
},
);
# 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);
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');
my $cloud = HTML::TagCloud::Extended->new(
font_size_range => 10
);
$cloud->font_size_range(10);
my $cloud = HTML::TagCloud::Extended->new(
css_class => 'mycloud',
);
$cloud->css_class('mycloud');
Lyo Kato <lyo.kato@gmail.com>
This library is free software. You can redistribute it and/or modify it under the same terms as perl itself.
|
HTML::TagCloud::Extended - HTML::TagCloud extension |