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