As you may have noticed, I switched to tagging of my blog entries and abandoned the category system of nucleus. This way it's very easy to add more than one topic to an entry.
The software
To implement this I used the nucleus plugins for tagging support of anand in the version of 2005-05-28. Following his documentation (which is still a bit rudimentary at the time of writing) it was pretty easy to get the system up. But as often I had to make some changes to the code to fit my needs.
My changes to the code
There're some things I needed to change because I didn't like the way they worked before or didn't work like they're supposed to work on my system.
- I didn't like the page bar. So I implemeted the one I used before with NP_ShowBlogs. Further on I added a blog specific option for the location of the page bar. There's still a bit to do. Right now the style is hard coded (there should be some versions to choose from or a free way to define the look), as well as the number of pages to show without interupting the list (10 right now).
- While testing the page bar code I saw that the original code didn't return the number of items per page as requested. It just worked on the first page. By looking a bit at the query code and comparing it to the query code of NP_ShowBlogs I found a difference in the usage of
LIMIT. The tags code usedLIMIT first, lastbut NP_ShowBlogsLIMIT first, number of items. So I changed this in NP_ItemsInTag accordingly and this seems to work so far. - As I want to use tags with spaces in it, I added a
rawurlencodeof the tags in the URL generation code. In Firefox it works without this actually but it breaks the standard compliance of the XHTML code. - To support Technorati better, I added the possibility to add a
relproperty to links of tags. This is used to add anrel="tag"to the tag links of an item (but not to the tag cloud). I did this because I have the impression that Technorati has problem getting the tags out off the RSS. - The tag cloud got some changes too:
- distingish 1 post and x posts (with x > 1) in the title,
- separate the tags using commas (I think this should become an option),
- round the font sizes showing how often a tag exists to one digit after the period. The approach of rakaz to use a logical markup is very interesting too and for the long run to be prefered (but maybe better using
<em>with some classes but this heavy nesting—I'd like to distinguish 5 to 7 levels at least).
If you would like to test these changes, download the gzipped diff to anands version of 2005-05-28 (2.3 kB).
Future enhancements
Working on the code I have some ideas what would be nice to change. Most important are some changes to the tag cloud, I think.
- Make it possible to show all tags and not only the tags of the last or a random selection of x posts.
- To make this easier I could think about a change to the tag cloud caching system. As I'm not firm with SQL and performance and so on this is just a rudimentary idea.
- I think adding a new table
plugin_tags_cloudwould help for this. Besides anidfield this would include atag_name,blogid(there is an entry for every tag per every blog it occurs in),count(number of occurence of this tag in blogblogid),lastentry (timestamp). The timestamp is a bit of a problem (what to do if an entry is deleted?), but with it you could even get a tag cloud sorted by time easily. - The tag cloud table should be updated on adding, editing, and deleting an entry. Doing this the tag cloud is always up to date and the table is only updated when neeeded.
- There should be an additional option to update the tag cloud table in the admin area, because this might be useful if you replay (partial) backups.
- I think adding a new table
- There should be some style options. For instance it would be nice to show the number of posts after the tag and it could even be interesting to show the tag cloud as a list.
I don't know yet, whether I'll work on some of these things or not. That depends on how urgently I “need” a feature. ;-)
May I ask you to put NP_tags.php and related stuff on you site or send it to me.
Learnprogramming.info is suspended and I was unable to find the plugin for download.
Actually I did plan to publish my modifications when I publish my skin. But unfortunately this is all quite some work, esp. to get a acceptable documentation written.
I did ask in the Nucleus forum (http://forum.nucleuscms.org...) if there's a new site. I hope anand is reading it. If there's no positive reply in the near future, I might decide to scrape all files together and publish it somehow...
Thanks for feedback on Showblogs and Tags. Will wait for feedback from forum or you post with Tags stuff.
So there's a new working download place for NP_Tags available: http://tamizhan.com/downloa... The documentation page at http://tamizhan.backpackit.... refers to it as well. Thanks for the tip of the not working download page, anand didn't know this himself yet as it seems (a much better place to ask is still in the Nucleus forum http://forum.nucleuscms.org though ;-)).