Tue, 6 May 2008

6:51 PM - Tag clouds

I'm working on adding a tag cloud to Just Journal. I haven't really thought about it much, but there is a bit to it. You need to have frequency counts for tags and their names.

That can be found with this query:

SELECT tags.name, count(entry_tags.tagid) as num from entry_tags, tags WHERE entry_tags.tagid = tags.id GROUP BY name;

That will sort by the name, and give counts.

midnightbsd 2
justjournal 2

etc...

Then you need to find the min and max values for the frequency. Also, you need to choose how many different levels you want for presentation. Do you want 3 font sizes? use max - min / 3 to find the points where you want to change the font size.

The database schema is broken up into two tables with 2 fields each (in use).

tag id and tag name in the tags table. entry_tags associates a tag with a blog entry. You have an entryid and a tagid.

tags: justjournal tags software

()