HTML::TagCloud
del.icio.us / miyagawa çµç±ã§è¦ã¤ãã CPAN ã¢ã¸ã¥ã¼ã« HTML::TagCloudãTag Cloud (ã¯ã¦ãªããã¯ãã¼ã¯ã®å³å´ã«åºã¦ããã¿ã°ä¸è¦§ã¿ãããªãã¤) ãçæãã CPAN ã¢ã¸ã¥ã¼ã«ã§ãã
åºåã¯ã©ããªæãããªã¨æã£ã¦ä½¿ã£ã¦ã¿ã¾ããã
#!/usr/local/bin/perl use strict; use HTML::TagCloud; my $tags = [ { tag => 'blog', count => 20}, { tag => 'ajax', count => 10}, { tag => 'mysql', count => 5}, { tag => 'hatena', count => 12}, { tag => 'bookmark', count => 30}, { tag => 'rss', count => 1}, { tag => 'atom', count => 2}, { tag => 'misc', count => 10}, { tag => 'javascript', count => 11}, { tag => 'xml', count => 6}, { tag => 'perl', count => 32}, ]; my $cloud = HTML::TagCloud->new; $cloud->add($_->{tag}, "http://b.hatena.ne.jp/naoya/$_->{tag}/", $_->{count}) for @$tags; print $cloud->html_and_css(20);
ãããªæãã®ã½ã¼ã¹ã§åºåãããçµæã¯ã
<style> span.tagcloud0 {font-size: 12px;} span.tagcloud0 a {text-decoration: none;} span.tagcloud1 {font-size: 13px;} span.tagcloud1 a {text-decoration: none;} span.tagcloud2 {font-size: 14px;} span.tagcloud2 a {text-decoration: none;} span.tagcloud3 {font-size: 15px;} ... </style> <span class="tagcloud11"><a href="http://b.hatena.ne.jp/naoya/ajax/">ajax</a></span> <span class="tagcloud2"><a href="http://b.hatena.ne.jp/naoya/atom/">atom</a></span> <span class="tagcloud17"><a href="http://b.hatena.ne.jp/naoya/blog/">blog</a></span> ...
ã¨ãã£ãå ·åã«ãªãã¾ãããã©ã¦ã¶ã§è¡¨ç¤ºããã¨ã
ãããªæãã«ãªãã¾ããããªãªã¸ãã«ã®ã¢ããªã±ã¼ã·ã§ã³ã§ã¿ã°ãå®è£ ãã¦ãã¦ãããã« Tag Cloud ã表示ãããã¨ããã¨ãã«ä½¿ããããè¦ãç®ãã«ã¹ã¿ãã¤ãºãããå ´åã¯ç¶æ¿ã㦠css ã¡ã½ããããªã¼ãã¼ã©ã¤ãããã°ãããã
ãã®ã¢ã¸ã¥ã¼ã«ã使ãã«ã¯ã¿ã°ã®ä¸è¦§ã¨ãããããã®ã¿ã°ãä½å使ããããã¨ãããã©ã¡ã¼ã¿ãå¿ è¦ã§ããã¨ããããã¨ã¯ããã¯ãã¼ã¯ã§ã¿ã°ä¸è¦§ãåå¾ãã API ãä½ãã¨ããã¨ããã¯ãå©ç¨åæ°ã®åºåãä¸ç·ã«ããã®ã¯å¿ é ãªæãã§ãããæçµå©ç¨æå»ãã¤ãã§ã«ä»ãã¦ããã°ãæ¿æ·¡ãä¸ç·ã«è¡¨ç¾ã§ããããã£ã¡ãå ¥ãããã¨ããã