Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Tags/Keywords Search Global

Quote Reply
Tags/Keywords Search Global
I am looking for a global the will take a series of keywords - that have been assigned to a link - and link them to a search of the database. I'm already aware of how to insert a column name to a search, eg.:

<a href="<%config.db_cgi_url%>/search.cgi?Keywords=<%Keywords%>"><%Keywords%></a>

This would work fine if the link only had one keyword, however each link is assigned anywhere from 5 - 20 keywords. They are seperated by a "," in the database.

Has anyone heard of a global that can accomplish this?

I am basically trying to create a tagging function for each of the links in the database. The links in the directory have all be assigned keywords, and I want the user to be able to click on a keywords (displayed on the links detailed page) and have all the links in the database that have the same keyword associated with it be pulled up on the search page. I am doing something similar with the [more] function here (for year published, author, etc:

It will essentially be a really simple tagging feature - similar to what you see on many weblogs and services like del.icio.us, etc.

Quote Reply
Re: [mapleleafweb] Tags/Keywords Search Global In reply to
I started working on a plugin for this a while back but haven't completed it yet. It involves using hooks on the add/modify/delete routines so that the tags are synced into seperate tables (this makes it MUCH easier to run queries and build results) . The plugin incorporates the HTML::TagCloud module from CPAN to assist with generating tag clouds, but will also create lists.

Anyway, if you want to just create text links for just one record, you can do something like this:

create a new global with the following value:
Code:
sub {
return { tag_loop => [ map { {tag => $_} } split(',', shift) ] };
}

Then in your template, do this:

Code:
<%global_name($Keywords)%>
<%loop tag_loop%>
<a href="<%config.db_cgi_url%>/search.cgi?Keywords=<%tag%>"><%tag%></a>
<%endloop%>

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Tags/Keywords Search Global In reply to
Thanks Philip!

That definitely sounds like an interesting plugin - certainly one that I would be interested in using. Your code suggestions worked perfectly, as you can see an example here. If you need some beta testers for your plugin, keep me in mind. You can contact via the contact from on policy.ca.

Quote Reply
Re: [mapleleafweb] Tags/Keywords Search Global In reply to
I'll let you know.

Right now it's on hold as I have two other plugins that need finishing first. Most of the code is written as 'pseudocode' (mix of real code that *probably* works, and some plain text) so it's not really in a form that can even be tested yet.

While we're on the subject, what kind of things would you be looking for in the plugin?

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [mapleleafweb] Tags/Keywords Search Global In reply to
Hi,

I have created a plugin called Tags Links which allow user can add tags for each link on your directory. After approved by admin, these tags are available on each link and its detaild page.

Please let me know if you would like to try that.

Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [mapleleafweb] Tags/Keywords Search Global In reply to
OK, I implemented Fuzzy's suggestions and everything is working great. You can see the results here just scroll down to the bottom and look at the Keyword / Tags section.

I've got another question. Is it possible to create a global that counts the total number of keywords (counting the number of individual instances of a particular keyword) and then create a tag cloud of those keyword/tags? I'm also interested in whether this could be done for each individual category. So if someone visited the Fiscal and Budgetary category they could get a listing of the top 20 tags/keywords used by the links in that particular category.

I admit, this is being to sound more like a plugin than a global - if so, how difficult would it be to create such functionality such as this?