NAME
HTML::TagClouder - Yet Another TagCloud Generator
SYNOPSIS
use HTML::TagClouder;
# All arguments are optional!
my $cloud = HTML::TagClouder->new(
collection_class => 'HTML::TagClouder::Collection::Simple',
collection_class_args => { ... },
processor_class => 'HTML::TagClouder::Collection::Processor::Simple',
processor_class_args => { ... },
render_class => 'HTML::TagClouder::Render::TT',
render_class_args => {
tt_args => {
INCLUDE_PATH => '/path/to/templates'
}
}
);
$cloud->add(HTML::TagClouder::Tag->new($label, $uri, $count, $timestamp));
$cloud->add($label, $uri, $count, $timestamp);
$cloud->render;
# or in your template
[% cloud %]
DESCRIPTION
*WARNING* Alpha software! I mean it!
HTML::TagClouder is just another take on generating Tagclouds. I built it for particular purpose, and so it may not do everything that you want either, but it's supposed to be designed with flexibility in mind, especially the presentation layer.
The basic concept is that there's a build-up phase via ->add, then there's the data process phase right before rendering, and finally the rendering. These should be separate, and configurable.
CAVEATS
The interface allows a timestamp argument, but it does nothing at this moment. I don't plan on using it for a while, so if you want it, patches welcome.
The above also means that currently there's no way to change the color of the tags. Of course, you can always create your own subclasses that does so.
METHODS
new %args
new() constructs a new HTML::TagClouder instance, and may take the following parameters. If a parameter is omitted, some sane default will be provided.
- collection_class
-
The HTML::TagClouder::Collection class name that will hold the tags while the cloud is being built
- collection_class_args
-
A hashref of arguments to be passed to the collection class' constructor.
- processor_class
-
The HTML::TagClouder::Processor class name that will be used to normalize the tags. This is responsible for calculating various attributes that will be used when rendering the tag cloud
- processor_class_args
-
A hashref of arguments to be passed to the processor class' constructor.
- render_class
-
The HTML::TagClouder::Render class name that will be used to render the tag cloud for presentation
- render_class_args
-
A hashref of arguments to be passed to the render class' constructor.
setup
Sets up the object.
add $tag
add $label, $uri, $count, $timestamp
Adds a new tag. Accepts either the parameters passed to HTML::TagClouder::Tag constructor, or a HTML::TagClouder::Tag instance
process
Processes the tags. This method will be automatically called from render()
render
Renders the tag cloud and returns the html.
SEE ALSO
HTML::TagCloud::Extended, HTML::TagCloud
AUTHOR
Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp>
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html