Skip to content
Derek Jones edited this page Jul 5, 2012 · 11 revisions

Category:Library::Community | Category:Library::TagCloud

Introduction

Taggly is a customizable CodeIgniter library that makes creating tag-clouds a snap. You can choose to use its basic functionality, or customize your tag-cloud by setting configurations options.

What is a Tag-Cloud?

A tag-cloud is a collection of text links with varying size (and sometimes color) based on their popularity. Sites such as Flickr, Delicious and Tag-A-Cloud use this concept.

Download Taggly

File:taggly.zip

Download Taggly 1.1

File:Taggly-1.1.zip

Usage

You can find more information in the User Guide included in the Taggly download package. Version 1.1 has the ability to highlight tags within your cloud by adding a Class and an Array to your config.

Code

The syntax in its very basic form is this:

$myArray = array (
    array(10, 'PHP', 'http://php.com'),
    array(32, 'MySQL', 'http://mysql.com'),
    array(5, 'CodeIgniter', 'http://codeigniter.com')
);

echo $this->taggly->cloud($myArray);

You can get more complex by passing configuration parameters:

$matchTags = array ('PHP','CodeIgniter');

$configArray = array (
    'min_font' => 20,
    'max_font' => 60,
    'html_start' => '<li>',
    'html_end' => '</li>',
    'shuffle' => TRUE,
    'class' => 'my_css_class',
    'find_Match' => $matchTags,
    'match_Class' => 'bold',
);

echo $this->taggly->cloud($myArray, $configArray);

Output

Taggly creates and returns links with defined sizes based on the data given in your array.

An example output:

<a style="font-size: 21px" class="taggly bold" href="http://example.com" title="PHP">PHP</a>
<a style="font-size: 18px" class="taggly" href="http://example.com" title="Image Ready">Image Ready</a>
<a style="font-size: 33px" class="taggly" href="http://example.com" title="Background">Background</a>
<a style="font-size: 33px" class="taggly" href="http://example.com" title="CodeIgniter">CodeIgniter</a>
<a style="font-size: 16px" class="taggly bold" href="http://example.com" title="CodeIgniter">CodeIgniter</a>
<a style="font-size: 23px" class="taggly" href="http://example.com" title="Depth">Depth</a>
<a style="font-size: 29px" class="taggly" href="http://example.com" title="Grafix">Grafix</a>
<a style="font-size: 18px" class="taggly" href="http://example.com" title="Adobe">Adobe</a>
Clone this wiki locally