[Paid accounts] Inserting a tag cloud in the sidebar or on the tag page

May 25, 2006 18:34


The code in this tutorial will create tag clouds, which can be inserted into a box in the sidebar, or into the tag page. A tag cloud is an alphabetised list of tags where the most commonly used tags are depicted in a larger font or otherwise emphasized.

To do that, the tags have to be divided into different categories according to their number of ( Read more... )

!tutorial, sidebar, tags

Leave a comment

Comments 64

kunzite1 May 25 2006, 19:48:40 UTC
sidebar #1 should prolly read "theme layer" instead of "layer theme."

and because i'm picky, i'd make the tagcloud on TagsPage look more like an entry. the hacks i made up for haven or opal should be a good start with getting an idea of how i'd do it which, imo, looks neater since it's all entry-like and stuff. :)

Reply

snakeling May 25 2006, 19:56:41 UTC
1. I can't believe none of us caught that :P

2. Oooh, shiny! I'll have a look at it this weekend, thanks :)

Reply

kunzite1 May 25 2006, 20:10:51 UTC
1. hee. :D
2. yay! i'm all about consistency.

Reply

snakeling May 25 2006, 21:01:38 UTC
2. Done! It was actually very easy, as I stole the code for the sticky post :P

Reply


(The comment has been removed)

afuna May 25 2006, 23:48:23 UTC
Eep. The tutorial was actually drafted up several days before, and we spent a few days tweaking it (well snakeling and murklinstest tweaked it *grin* I just sat back and watched them.)

If you're interested in seeing tutorials before they come out, you could try monitoring s2flexitalk, our drafts/discussion community. Feel free to jump in to any active discussions, although I don't think there are any active right now. In any case, feel free to start your own! ;)

If you've got any cool new tutorials that you want to post to s2flexisquares, but you want someone to look over them first, you can also post them to s2flexitalk and just wait a bit. No guarantees that we'll catch everything, but someone will usually catch a bit of something (that sounds vaguely nasty).

*pimps*

Reply


xheather June 2 2006, 08:18:32 UTC
when I do this, along with the tutorial that moves my tags below my metadata, it totally kills my layout in IE. Any clue as to why this happens? Thanks in advance...

Reply

afuna June 2 2006, 19:19:07 UTC
The division by zero? It happens in all browsers, since it has to do with S2 :)

Please make your theme layer viewable, and give us the link.

Reply

snakeling June 2 2006, 19:58:57 UTC
I just realised that if someone has the same number of uses for all tags, $max_use_count - $min_use_count will be 0 and give an error message. But it's easy to debug. Once $max_use_count and $min_use_count have been determined, you only have to add something like:
if ($min_use_count == $max_use_count)
{
$max_use_count = $max_use_count + 1;
}And how much do you want to bet that the OP's problem is that she's logged in in Firefox and so have no problems because she has a lot of tags, but she isn't logged in in IE, and thus sees only her unique tag with one use?

I'm going to add the line right now :)

Reply

afuna June 3 2006, 11:49:35 UTC
Nice catch :) Perhaps add a note at the bottom of the post stating that it has been updated for the sake of those who used the code earlier?

And hee! So it is the browser's fault, and yet it's not :D

Reply


purecreation June 3 2006, 04:34:32 UTC
Sorry if this is the wrong topic, but I it was the closest I could find. Would anyone happen to know if there'd be a way to add a NORMAL list of tags to the sidebar for a community? It looks like you guys have done it here for this one. I already tried adding another extra box with theme layers, but apparently that doesn't work for communities (even if you have a paid account.) My customized community is here sunkissed_icons. The CSS stylesheet I'm using is HERE... Any help would be great!

Reply

snakeling June 3 2006, 05:36:01 UTC
The comm needs to be paid :)

The simple tag list tutorial is here.

Reply

purecreation June 3 2006, 06:52:14 UTC
fizz_i_cons seems to have managed what I was looking for, and it is a free community account. Wouldn't there be some way to incorporate this into flexisquares?

Reply

snakeling June 3 2006, 13:02:08 UTC
fizz_i_cons uses Smooth Sailing (s2smoothsailing) which proposes a tag list in the sidebar for free accounts. Flexible Squares doesn't, sorry.

Reply


427 June 13 2006, 23:22:19 UTC
Ok - I've stuck it in, it's working. (other than some text formating I need to alter to the way I want it to look). My issue:

Drop tags that have less than x number of uses.

This should create a bubbling of the more common tags, and provide more of a difference in size.

Any help? :D thanks

Reply

snakeling June 14 2006, 10:11:52 UTC
provide more of a difference in size.
The difference in size is something that you control anyway. Augment the increment and/or the number of categories :)

Here's the new tag cloud code (in green is what I changed):
#### TAG CLOUD CODE ####

###### Configuration ######

var int tag_category = 8; # The number can be changed if you want more or fewer categories.
var int basefontsize = 80; # size of the first tag category in percent of the default font size of the page.
var int increment = 50; # The difference in size between tag categories.
var string subject = "Tag cloud"; # Title of the tag page.
var int no_print_tag = 3 ; # Minimum number of uses of the tag for it to print.

###### End Configuration ######

var Page p = get_page();
var string list = "";
var int max_use_count = 0 ;
var int min_use_count ;
var int x ;

if (size $p->visible_tag_list() > 0)
{

# Define a maximum number of uses of the tags:
var TagDetail[] visible_tag_list = $p->visible_tag_list();
if($visible_tag_list)
{
foreach var TagDetail td ($p ( ... )

Reply

427 June 14 2006, 14:39:42 UTC
^^ It works - Thanks :D

Reply

snakeling June 14 2006, 21:34:39 UTC
You're welcome :)

Reply


Leave a comment

Up