Blogger Tag Cloud Script

Being bored on a Monday morning, I wrote this script.

Its’ for bloggers with an FTP account, (non-blogspot account), this tag cloud will read the contents of your ‘labels’ folder and create a formatted cloud of links based on file sizes and category headings.

Blogger Tag Cloud Script – (php server – php 4 or higher)

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">




Untitled Document










Chunky Borders


// php tag cloud - blogger ftp accounts tag cloud for labels folder.
// The tag cloud automatically takes the contents of your labels folder,
// reads the files and gives the values according to the number of posts.
// Change the 'labels' location marked.
// Please leave my little marker at the bottom. Thanks.

$handle = opendir('../labels/'); // change **
if (!empty($handle))
{
while (false !== ($page = readdir($handle)))
{
if ($page != "." && $page != "..")
{ $filesize = filesize('../labels/'.$page); // change **
$labels[] = array ("page" => $page, "filesize" => $filesize); }
}


}
// tag cloud functionality ===
foreach ($labels as $key => $value){
$tags[$value["page"]] = $value["filesize"];
}

$max_size = 180; // max font size in %
$min_size = 58; // min font size in %


$max_qty = max(array_values($tags));
$min_qty = min(array_values($tags));


$spread = $max_qty - $min_qty;
if (0 == $spread) {
$spread = 1;
}


$step = ($max_size - $min_size)/($spread);

foreach ($tags as $key => $value) {
$size = $min_size + (($value - $min_qty) * $step);

echo 'style="font-size: '.$size.'%; font-weight: 200; "'; // change **
$delim = '.';
$page = substr($key, 0, strpos($key, $delim));
echo ' title="'.$page.'" >'.$page.'
';
}
// end tag cloud

?>











Related Reading

Bonnie does London – Henley-on-Thames to Windsor

Bonnie is all warmed up now, and ready to go… So here we go, down to London! A morning in Henley Woke up and felt...

adult-friend-finder-hacked
The biggest hacks of 2016 – A year in hacking

In case you didn’t know, in amongst the celebrity deaths, and the unraveling of the NWO bandwagon, 2016 was also a bumper year for hackers....

Fitting flexible solar panels to a narrowboat

This is a short guide to installing flexible solar panels to a narrowboat. How long do flexible solar panels last for? No doubt, less long...

Spiceball park, Cropredy and beyond

As June draws near, Bonnie needs to travel North. This year, she’s going in for blacking. The last time I had this done was July...

Tree lined Autumn boulevard
Black swan event in Cropredy

A black swan event occurring just as I enter Cropredy. Is it an omen?

Author: Michael Tyler

Owner and main contributor to the michaeltyler.co.uk, a site about my travels and day to day life on the canal.

2 thoughts on “Blogger Tag Cloud Script”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.