| 1 |
NAME |
| 2 |
HTML::TagCloud - Generate An HTML Tag Cloud |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
my $cloud = HTML::TagCloud->new; |
| 6 |
$cloud->add($tag1, $url1, $count1); |
| 7 |
$cloud->add($tag2, $url2, $count2); |
| 8 |
$cloud->add($tag3, $url3, $count3); |
| 9 |
my $html = $cloud->html_and_css(50); |
| 10 |
|
| 11 |
DESCRIPTION |
| 12 |
The HTML::TagCloud module enables you to generate "tag clouds" in HTML. |
| 13 |
Tag clouds serve as a textual way to visualize terms and topics that are |
| 14 |
used most frequently. The tags are sorted alphabetically and a larger |
| 15 |
font is used to indicate more frequent term usage. |
| 16 |
|
| 17 |
Example sites with tag clouds: <http://www.43things.com/>, |
| 18 |
<http://www.astray.com/recipes/> and |
| 19 |
<http://www.flickr.com/photos/tags/>. |
| 20 |
|
| 21 |
This module provides a simple interface to generating a CSS-based HTML |
| 22 |
tag cloud. You simply pass in a set of tags, their URL and their count. |
| 23 |
This module outputs stylesheet-based HTML. You may use the included CSS |
| 24 |
or use your own. |
| 25 |
|
| 26 |
CONSTRUCTOR |
| 27 |
new |
| 28 |
The constructor takes one optional argument: |
| 29 |
|
| 30 |
my $cloud = HTML::TagCloud->new(levels=>10); |
| 31 |
|
| 32 |
if not provided, leves defaults to 24 |
| 33 |
|
| 34 |
METHODS |
| 35 |
add |
| 36 |
This module adds a tag into the cloud. You pass in the tag name, its URL |
| 37 |
and its count: |
| 38 |
|
| 39 |
$cloud->add($tag1, $url1, $count1); |
| 40 |
$cloud->add($tag2, $url2, $count2); |
| 41 |
$cloud->add($tag3, $url3, $count3); |
| 42 |
|
| 43 |
tags($limit) |
| 44 |
Returns a list of hashrefs representing each tag in the cloud, sorted by |
| 45 |
alphabet. each tag has the following keys; name, count, url and level. |
| 46 |
|
| 47 |
css |
| 48 |
This returns the CSS that will format the HTML returned by the html() |
| 49 |
method with tags which have a high count as larger: |
| 50 |
|
| 51 |
my $css = $cloud->css; |
| 52 |
|
| 53 |
html($limit) |
| 54 |
This returns the tag cloud as HTML without the embedded CSS (you should |
| 55 |
use both css() and html() or simply the html_and_css() method). If a |
| 56 |
limit is provided, only the top $limit tags are in the cloud, otherwise |
| 57 |
all the tags are in the cloud: |
| 58 |
|
| 59 |
my $html = $cloud->html(200); |
| 60 |
|
| 61 |
html_and_css($limit) |
| 62 |
This returns the tag cloud as HTML with embedded CSS. If a limit is |
| 63 |
provided, only the top $limit tags are in the cloud, otherwise all the |
| 64 |
tags are in the cloud: |
| 65 |
|
| 66 |
my $html_and_css = $cloud->html_and_css(50); |
| 67 |
|
| 68 |
AUTHOR |
| 69 |
Leon Brocard, "<[email protected]>". |
| 70 |
|
| 71 |
SUPPORT |
| 72 |
|
| 73 |
The current repository for this project is maintained on GitHub: |
| 74 |
|
| 75 |
https://github.com/dennisroberts71/HTML-TagCloud |
| 76 |
|
| 77 |
Please feel free to report any problems in the issue tracker for this |
| 78 |
repository. |
| 79 |
|
| 80 |
COPYRIGHT |
| 81 |
Copyright (C) 2005, Leon Brocard |
| 82 |
|
| 83 |
This module is free software; you can redistribute it or modify it under |
| 84 |
the same terms as Perl itself. |