GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTML::TagCloud(3) User Contributed Perl Documentation HTML::TagCloud(3)

HTML::TagCloud - Generate An HTML Tag Cloud

  # A cloud with tags that link to other web pages.
  my $cloud = HTML::TagCloud->new;
  $cloud->add($tag1, $url1, $count1);
  $cloud->add($tag2, $url2, $count2);
  $cloud->add($tag3, $url3, $count3);
  my $html = $cloud->html_and_css(50);

  # A cloud with tags that do not link to other web pages.
  my $cloud = HTML::TagCloud->new;
  $cloud->add_static($tag1, $count1);
  $cloud->add_static($tag2, $count2);
  $cloud->add_static($tag3, $count3);
  my $html = $cloud->html_and_css(50);

  # A cloud that is comprised of tags in multiple categories.
  my $cloud = HTML::TagCloud->new;
  $cloud->add($tag1, $url1, $count1, $category1);
  $cloud->add($tag2, $url2, $count2, $category2);
  $cloud->add($tag3, $url3, $count3, $category3);
  my $html = $cloud->html_and_css(50);

  # The same cloud without tags that link to other web pages.
  my $cloud = HTML::TagCloud->new;
  $cloud->add_static($tag1, $count1, $category1);
  $cloud->add_static($tag2, $count2, $category2);
  $cloud->add_static($tag3, $count3, $category3);
  my $html = $cloud->html_and_css(50);

  # Obtaining uncategorized HTML for a categorized tag cloud.
  my $html = $cloud->html_without_categories();

  # Explicitly requesting categorized HTML.
  my $html = $cloud->html_with_categories();

The HTML::TagCloud module enables you to generate "tag clouds" in HTML. Tag clouds serve as a textual way to visualize terms and topics that are used most frequently. The tags are sorted alphabetically and a larger font is used to indicate more frequent term usage.

Example sites with tag clouds: <http://www.43things.com/>, <http://www.astray.com/recipes/> and <http://www.flickr.com/photos/tags/>.

This module provides a simple interface to generating a CSS-based HTML tag cloud. You simply pass in a set of tags, their URL and their count. This module outputs stylesheet-based HTML. You may use the included CSS or use your own.

The constructor takes a few optional arguments:

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

if not provided, levels defaults to 24

  my $cloud = HTML::TagCloud->new(distinguish_adjacent_tags=>1);

If distinguish_adjacent_tags is true HTML::TagCloud will use different CSS classes for adjacent tags in order to be able to make it easier to distinguish adjacent multi-word tags. If not specified, this parameter defaults to a false value.

  my $cloud = HTML::TagCloud->new(categories=>\@categories);

If categories are provided then tags are grouped in separate divisions by category when the HTML fragment is generated.

This module adds a tag into the cloud. You pass in the tag name, its URL and its count:

  $cloud->add($tag1, $url1, $count1);
  $cloud->add($tag2, $url2, $count2);
  $cloud->add($tag3, $url3, $count3);

This module adds a tag that does not link to another web page into the cloud. You pass in the tag name and its count:

  $cloud->add_static($tag1, $count1);
  $cloud->add_static($tag2, $count2);

Returns a list of hashrefs representing each tag in the cloud, sorted by alphabet. Each tag has the following keys: name, count, url and level.

This returns the CSS that will format the HTML returned by the html() method with tags which have a high count as larger:

  my $css  = $cloud->css;

This returns the tag cloud as HTML without the embedded CSS (you should use both css() and html() or simply the html_and_css() method). If any categories were specified when items were being placed in the cloud then the tags will be organized into divisions by category name. If a limit is provided, only the top $limit tags are in the cloud, otherwise all the tags are in the cloud:

  my $html = $cloud->html(200);

This returns the tag cloud as HTML without the embedded CSS. The tags will be arranged into divisions by category. If a limit is provided, only the top $limit tags are in the cloud. Otherwise, all tags are in the cloud.

This returns the tag cloud as HTML without the embedded CSS. The tags will not be grouped by category if this method is used to generate the HTML.

This returns the tag cloud as HTML with embedded CSS. If a limit is provided, only the top $limit tags are in the cloud, otherwise all the tags are in the cloud:

  my $html_and_css = $cloud->html_and_css(50);

Leon Brocard, "<acme@astray.com>".

Copyright (C) 2005-6, Leon Brocard

This module is free software; you can redistribute it or modify it under the same terms as Perl itself.

2013-04-20 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.