Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-05 08:52:37

truist
Plugin Author
From: Ohio, USA
Registered: 2004-11-09
Posts: 257
Website

tru_tags: A tagging plugin for textpattern

Last December, when I converted my old site over to Textpattern, I also wrote a tagging plugin. I haven’t published it until now. I started with Ran Aroussi’s ran_tags, but essentially completely rewrote it to add features, remove bugs, and improve security. It heavily relies on (e.g. reuses) the Textpattern code, so the plugin itself is rather small. But because of that reliance, tags have to be entered into the Keywords field, and custom fields can’t be used (for tagging).

It has the usual tagging features (listing tags for an article, tag clouds, listing articles for a tag), and it allows you to use standard Textpattern conventions like wraptag / break / class. It is smart about future-dated and ‘draft’ articles, and doesn’t show tags from them. And since its first release, I’ve added a gajillion new features.

There are four pages about the plugin on my website:

Please see the releases page to download the latest version.

Please note: this plugin was originally hosted on my old website, truist.com, but has since moved to rainskit.com. I’ve tried to update all the links and email addresses appropriately, but you may find out that is out of date. If so, please just substitute “rainskit.com” for “truist.com” and that should do the trick.

Last edited by truist (2012-01-20 03:59:03)

Offline

#2 2006-03-05 10:02:40

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,577
Website

Re: tru_tags: A tagging plugin for textpattern

hi nathan, it looks very interesting and more integrated with textpattern’s way of working. Although, I’ve not tried it I have read that ran_tags slows down considerably with many articles. It sounds like your version could alleviate that problem.

One question: Do any of the tag plug-ins allow one to search for combinations of tags, for instance to search for life and tech on your site and get only those articles with both?


TXP Builders – finely-crafted code, design and txp

Offline

#3 2006-03-05 16:36:03

soulship
Member
From: Always Sunny Charleston
Registered: 2004-04-30
Posts: 669
Website

Re: tru_tags: A tagging plugin for textpattern

Thanks alot Nathan. It looks like you put alot of thought and time into this. I am installing now to give it a whirl. I will let you know if I see any bugs :)

Offline

#4 2006-03-05 19:03:33

truist
Plugin Author
From: Ohio, USA
Registered: 2004-11-09
Posts: 257
Website

Re: tru_tags: A tagging plugin for textpattern

I have read that ran_tags slows down considerably with many articles

tru_tags may have that same, problem – do you have a way to test? I hadn’t heard of it before now. If there is an issue, it’s almost certainly in the cloud generation, but my guess is that it shouldn’t start to cause problems until there were thousands of articles with many, many tags.

Do any of the tag plug-ins allow one to search for combinations of tags

tru_tags doesn’t, not like you ask. You can do an OR search (where you’d get all articles with “life” OR “tech”) just by writing an appropriate url. For example, check out http://www.truist.com/tag?t=life,tech. It’s essentially impossible to get what you want from tru_tags, because it’s using Textpattern’s code to do the searching (publish.php, doArticles()), and that code just does an OR search.

soulship – thanks for your comments – I hope it works well for you!

Offline

#5 2006-03-06 00:20:45

semanio
Member
Registered: 2005-10-18
Posts: 20

Re: tru_tags: A tagging plugin for textpattern

Nathan,

Greate solution! I used to use the ran_tags plug-in but it lacked a few features that I wanted so I decided to give yours a whirl today. Leave it to me to already have one question for you.

With the ran_tags plugin when you click on a tag from the cloud list it shows a listing of article titles by date associated with the selected tag. Is this possible with your plugin? Rather than displaying the full article? It might be that I’m just missing something or do not know how to do this in textpattern.

Thanks for your help in advance,
Nate H

Offline

#6 2006-03-06 01:11:24

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,577
Website

Re: tru_tags: A tagging plugin for textpattern

truist: thanks for the feedback. I’d been fiddling around with searching using two categories and wondered if perhaps tags might be a better (and limitless) alternative. From what you say, it seems at the moment not to be.


TXP Builders – finely-crafted code, design and txp

Offline

#7 2006-03-06 12:31:16

p_see
Member
Registered: 2006-02-24
Posts: 17

Re: tru_tags: A tagging plugin for textpattern

Problem with messy URL.
This is the type of url we got :<code>tag?t=nikon </code> instead of:<code> ?s=tag&t=nikon </code>.
So I have changed in the plugin the 2 lines of the path url like this:
<code>$url = ‘http://’ . $siteurl . $path_from_root .’?s=’. $tagsection . ‘&t=’;</code>
It works with it.

Thanks very much for this plug whitch is THE ONE we wait for.

Offline

#8 2006-03-06 14:46:27

papalozarou
Member
Registered: 2004-07-05
Posts: 43

Re: tru_tags: A tagging plugin for textpattern

I have two questions that I couldn’t find answered in the documentation (apologies if I missed it):

1. Does this support clean urls?
2. Does it output the rel=“tag” bit in the links?

Cheers.

Offline

#9 2006-03-07 01:37:52

soulship
Member
From: Always Sunny Charleston
Registered: 2004-04-30
Posts: 669
Website

Re: tru_tags: A tagging plugin for textpattern

It does not output the rel=“tag” in the links, but it works fine with a clean url scheme.

Offline

#10 2006-03-07 03:50:52

truist
Plugin Author
From: Ohio, USA
Registered: 2004-11-09
Posts: 257
Website

Re: tru_tags: A tagging plugin for textpattern

Some feedback to all of the above messages. Sadly, no good answers.

it shows a listing of article titles by date associated with the selected tag. Is this possible with your plugin

Not the way it is written, no. All of the code in ran_tags that did that has been completely replaced by one call to “doArticles(),” and the ran_tags code was not configurable, and didn’t output in a format that I liked.

I did try (just now), however, to integrate the ran_tags code into tru_tags. I got it working, in that it would spit out a list of articles grouped by month, but it wasn’t actually finding all the articles. It appeared to be missing the first article, every time. I didn’t chase it past that.

If you really want it, you could modify tru_tags to add the relevant bits from ran_tags yourself. If you can fix (or avoid altogether) the bug I saw, I’ll incorporate it on my site. The place to look is ran_tags_list_tag($atts) in ran_tags, and you want to take most of the code from there and drop it into tru_tags_handler($atts) in tru_tags, inside the ‘else’.

fiddling around with searching using two categories and wondered if perhaps tags might be a better (and limitless) alternative

I think tagging is what you are looking for, and it’s just the tagging implementations that are lacking. From a brief glance at chh_keywords, it might do what you want.

I think you could also get what you want, using tru_tags, with a very simple modification to the Textpattern code, although you’d still have to figure out a way to generate the links. (If you do change the Textpattern code, talk to me about adding link-generation support to tru_tags – it might be very interesting.)

The bit you want to change is line 586 of /textpattern/publish.php. (This is for txp 4.03) It’s the line in doArticles() that generates the bit of the SQL query that has to do with keywords. The current line is:

$keywords = “ and (” . join(’ or ‘,$keyparts) . “)”;

and you’d want to change it to:

$keywords = “ and (” . join(’ and ‘,$keyparts) . “)”;

That will do what you want.

So I have changed in the plugin the 2 lines of the path url like this:

p_see – why do you want the different url? Just so it is “completely messy” rather than “partially messy”? Is one better than the other? (I’m not criticizing – I’m wondering if I should make the change.)

This also made me think of something – the tag cloud can be limited to just show tags from one section (with the section=XXX) attribute, but when you click a tag link from the cloud, it shows articles from all sections. There doesn’t appear to be anything I can do about that – it’s an effect of the way doArticles() works. So be warned, that that’s the behavior.

Does this support clean urls? Does it output the rel=”tag” bit in the links?

No and no. Clean urls should be possible, as other plugins have done it. But I have no idea how to make it work, and my brief dive into chh_keywords to try to figure it out scared the crap out of me :) And without clean urls, rel=“tag” attributes aren’t possible (per the spec). Anyone willing to help?

Offline

#11 2006-03-07 04:18:52

truist
Plugin Author
From: Ohio, USA
Registered: 2004-11-09
Posts: 257
Website

Re: tru_tags: A tagging plugin for textpattern

I’ve bumped the plugin to v1.0. The only feature change was to support multiple sections in the “section” attribute of tru_tags_cloud. Beyond that, I added text to the code and help about the copyright, license, and ran_tags.

Download v1.0 here

Last edited by truist (2008-07-03 12:07:57)

Offline

#12 2006-03-07 17:06:05

gdtroiano
Archived Plugin Author
From: Highland Park, NJ
Registered: 2005-01-29
Posts: 59
Website

Re: tru_tags: A tagging plugin for textpattern

Is it just me or do the class and breakclass attributes not work?

Offline

Board footer

Powered by FluxBB