Textpattern Forum

You are not logged in. Register | Login | Help

#1 2008-10-15 21:15:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,799
Website

smd_tags: unlimited article, image, file and link taxonomy

After many false promises, over 6 months of rewrites / re-evaluations, and a few thousand lines of code, I’m sick of looking at it. So here is the official smd_tags for you all to break.

Download smd_tags.

It started life as smd_unlimited_categories for all TXP data types, but in the process of writing it I figured it kind of bridged the gap between the excellent rss_unlimited_categories and tru_tags. Unlimited categories was too long to keep typing, so I chose tags instead :-)

Anyway, the features:

  • Unlimited tagging for articles, images, files and links
  • Fast tagging, (almost) mouse-free system for copying, auto-naming, and optional auto-completion
  • Multi-edits and live tag search on the admin side
  • Import article tags from tru_tags and rss_unlimited_categories
  • Tag nesting
  • Optionally link tags to TXP categories so clients can only choose from a limited set of tags
  • Assign tags via a dropdown select list, a text area or a list of clickable tags
  • Set up (optional) trigger words to allow tag filtering via the URL (clean or messy: your choice)
  • List / filter tags by type and name, as lists, trees, or a tag cloud
  • Find related content by tag, or match with any TXP field
  • Tag usage counts and conditional output

Still to do, err maybe, in no particular order:

  • Fix for foreign character autotag dumbdown
  • Tag and type paging support: next/prev/older/newer
  • Tag feed injection
  • Global tags
  • Multi-tag filtering from the URL (‘OR’ matching is undocumented but available: ‘AND’ in the works)
  • Anything anybody thinks is reasonably missing

I am indebted to the work of those who wrote amazing stuff before and have helped guide the development. Namely wilshire, truist, merz1, net-carver and uli, plus devs past. Thank you all.

Onto the few caveats:

  • Requires TXP 4.2.0 but 4.3.0 is highly recommended. It will not run (even install properly) under TXP 4.0.x though there are no checks to warn you, it’ll just whimper a lot, run into the corner with its tail between its legs and shoot itself.
  • The autotag dumbdown for foreign (non-ASCII) characters doesn’t work; the characters will simply be ignored which is not what you want. Coding powerhouse net-carver graciously poked me in the direction of a possible (and cunning) fix but I’ve yet to try it. In the meantime if you use a lot of non-ASCII characters, consider turning off auto-tagging so TXP can make a better job of it than the plugin.
  • See the top of the source code for a list of things I know about and can’t figure out quite yet.

Anyway, I’ll stop wiffling and let you play. Once the plugin is activated, visit Extensions->smd Tags and get stuck in. There are links to the plugin help file from the admin side in case you get stuck.

I hope it’s useful. Now go play in my tagging toolshed.

Revision history
————————

All available versions and changes are listed here. Each entry indexes the relevant post(s) in the threads to learn about the features.

Beta:

  • 15 Feb 2008 | 0.1 | Initial beta release
  • 16 Feb 2008 | 0.11 | Fixed help regarding auto-complete (thanks thebombsite) ; fixed remove table and added installation debug option (thanks jpdupont)
  • 16 Apr 2009 | 0.2 | added Text area+”:http://forum.textpattern.com/viewtopic.php?pid=204126#p204126 ; select list size of 1 converts tag input to a single-entry dropdown (thanks thebombsite) ; fixed width of tag list in link pane ; fixed potential context array warning ; non-messy URL rewriting fixed ; began work on multi-filtering ; TXP 4.0.7+ database warnings fixed ; non-messy URL rewriting fixed ; added smd_related_tags status attribute: (thanks johnstephens) ; smd_if_tag: now correctly works outside smd_tag_list context (thanks danwoodward)
  • 23 Mar 2010 | 0.3 | Requires 4.2.0+ ; consolidated admin and client plugins ; added plugin lifecycle and prefs events ; fixed textarea/textarea+ jQuery ‘@’ bug and non-saves (thanks Zanza) ; fixed middot HTML entity ; added table prefix to smd_related_tags (thanks MattD)
  • 13 Apr 2010 | 0.31 | Maintenance release ; fixed smd_tag_list parent attribute (thanks woof) ; fixed smd_if_tag so it can correctly compare empty strings (thanks johnstephens); fixed admin side snafu if privs less than Managing Editor ; fixed slow response when saving tags ; fixed tag category lists if no cat(s) selected ; enhanced sublevel ; added pad_str and pad_pos to smd_tag_name ; tidied tag manager screen ; made warning messages blink

Official:

  • 05 Feb 2011 | 0.40 | Added live search and multi-edit functions ; improved performance ; added tag import from tru_tags and rss_unlimited_categories ; enabled delimited tag entry ; fixed rogue slashes in cat lists ; fixed URL handler and smd_tag_name to support per-section tag lists, clean URL syntax, and enabled multiple trigger words (all thanks jakob) ; PHP 5.3 compatibility fix (thanks birdhouse) ; fixed warnings in smd_related_tags ; fixed tag list when no linked cats selected and when category changed ; added ‘list’ and ‘group’ tag display options; added sort, showall and flavour to smd_tag_list for tree and tag cloud support; added lettername, lettertitle and weight items to smd_tag_info for building alphabetic tag groups and clouds ; changed table collation to utf8_general_ci and improved unicode support ; fixed bug in smd_if_tag (again!) when using non-eq tests ; added style to smd_tag_name and smd_tag_count

Last edited by Bloke (2011-10-11 19:33:57)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#2 2008-10-15 21:54:17

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: smd_tags: unlimited article, image, file and link taxonomy

I’m getting a blank page when I try to install the admin plug-in (the client is OK) which suggests it’s too big. Do you have a zipped version Stef?


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2008-10-15 22:05:47

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,799
Website

Re: smd_tags: unlimited article, image, file and link taxonomy

thebombsite wrote:

Do you have a zipped version Stef?

Yes, I made a zipped version but forgot to put it in the post. Haha, what was I saying about missing the obvious stuff ;-)

1st post updated, thanks for pointing that out.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2008-10-15 22:31:15

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: smd_tags: unlimited article, image, file and link taxonomy

Oooo! That works thanks.

It will probably take me a week to work all this out but once I get the “click”. I know you know what I mean. ;)


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2008-10-15 22:52:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,799
Website

Re: smd_tags: unlimited article, image, file and link taxonomy

Yeah, I know what you mean! I kind of take the interface for granted because I’ve been staring at it for the past 6 months. Now I really need a tonne of fresh sets of eyes to find out where I’ve made crap assumptions :-)

Further to the first post, and just to clarify the position of this plugin a little, it is a hybrid of the two rss_uc and tru_tags plugins because with rss_uc the categories have to be pre-configured before they can be used whereas tru_tags — I believe — is freeformish via the keywords field.

I chose the structured approach of rss_uc and positioned the tag entry system under the categories to reflect this. My reasoning was:

  • Minimises typos
  • Gives better separation of roles: configurator-type-person and content-making type person
  • Gives site admins more control over what content authors can use as a tag (though the flipside is the content authors themselves can’t edit the tags unless they have sufficient privs — that reminds me, can someone check this out: I think I should probably test for privs before adding the ‘[Edit]’ links, thus it’ll probably just take you to a ‘restricted’ page right now)
  • Allows people with vast armies of tags the ability to subdivide them based on TXP category to make the lists more manageable. Heap thanks and praise on Markus Merz for the tag->category linkage idea. It’s not nearly as flexible as he wants it (yet) but it has huge potential for URL filtering of content once I can get my head round it
  • Tag nesting is a real bonus if used well (hint: assign a TXP category to a top-level tag and all sub-tags get pulled along with it), and is not easy without some kind of structure behind it

But after I’d done that I found a select list too restrictive. So I went back and allowed you to choose between a select list (like rss_uc), a text area or a clickable list of tags that highglight on and off (akin to the tru_tags approach). So it has the feel of neither one nor the other. The text area allows you to type in arbitrary tags but they will not be saved, which is why the jQuery auto-complete plugin is a good idea for a) saving typing and b) validating that the tags are acceptable. Depending on how strict you want the auto-complete set up, unacceptable tags can either be outright rejected if they are not connected to the current type/category or allowed to be saved if they exist somewhere for that type.

At least, that’s the theory. I’m sure this will fall over at some point and I already know of a few problems with it (esp. when deleting categories or changing category assignments in the smd_tags pane).

If there’s enough outcry I may be able to find a way of saving arbitrarily typed tags while still maintaining the structure in the back end. That sort of decision can really only be driven from people using this in anger and becoming pissed off with it!

btw, I would love to give the option to hook the entry boxes wherever you like in the interface, but the back-end DOM is such a mess of IDs and classes that frankly it’s more hassle than it’s worth (believe me, I tried!). Not to mention that the Links tab works differently to the other three…

Anyway, hopefully that’s given a bit of insight into the way the thing operates and why it does stuff the way it does.

Last edited by Bloke (2008-10-15 22:59:59)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#6 2008-10-15 23:06:04

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: smd_tags: unlimited article, image, file and link taxonomy

Well the first hurdle for me was to install the auto-complete plug-in which I’ve done but then your interface asks for the js and css folders relative to “textpattern”. By that do you mean the /textpattern/ directory or the root? Maybe an example in the interface would be useful for a future release?

I’m off to bed now as I have a job to go to in the morning and they are getting scarce apparently so I shall pick this up tomorrow. :)


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#7 2008-10-15 23:34:07

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,799
Website

Re: smd_tags: unlimited article, image, file and link taxonomy

thebombsite wrote:

interface asks for the js and css folders relative to “textpattern”. By that do you mean the /textpattern/ directory or the root?

Ah yes, *cough* confusingly it appears to be uhh, both. The help could do with sprucing up here a bit, methinx!

For some reason I thought it was always relative to the textpattern directory (hence the hint in the admin interface) but upon reflection it seems it’s not necessarily that. Humbug. I think I changed the way it worked and forgot to update the gTxt().

For example, my structure is:

site root
  |- css
  |- files
  |- images
  |- scripts
  |- textpattern

and I can specify the two directories as the absolute paths /scripts and /css respectively, upload the two files to those directories and the plugin will pick up the auto-complete tool then. But I could also specify the two directories as ../scripts and ../css (i.e. relative to the “textpattern” directory, as if you were ‘inside’ the dir to begin with) and it will also pick them up fine. It’s your call which you prefer, but some examples would certainly be of benefit in the help file. Will add those in, thanks for the catch.

One other thing to note that I forgot to mention in the help (one of those days…) is that the plugin looks for these filenames:

jquery.autocomplete.pack.js

and

jquery.autocomplete.css

I think I intended to allow you to be able to specify the entire path + file name if you wanted but never got round to it. Perhaps next time I’ll allow you to override the file names as well if you wish, as some servers do have trouble with the .pack versions. If you get no joy with the .pack files you’ll have to edit the plugin code for now to change the file names (or cheat and rename the non-pack file with .pack in it!). Will put this on the ToDo list.

Last edited by Bloke (2008-10-15 23:46:58)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2008-10-16 06:52:21

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 426

Re: smd_tags: unlimited article, image, file and link taxonomy

Hello Stef,

I get this when in the extension tab ( I have clicked a first time on “install tables”):

=============================
Tag tables NOT installed.
Not all table info available.

This is either a new installation or a different version
of the plugin to one you had before.

Click “Install tables” to add or update the tables
leaving all existing data untouched.
==========================

Now, if I click again on the Install table I get this errors :

==========================
Warning: Duplicate entry ‘1’ for key 1 INSERT INTO `txp_smd_tags` VALUES (1, ‘root’, ‘article’, ‘’, 1, 2, ‘root’) in /home/.navy/ampmultimedia/56tti.info/textpattern/lib/txplib_db.php on line 81
1. Duplicate entry ‘1’ for key 1

Warning: Duplicate entry ‘2’ for key 1 INSERT INTO `txp_smd_tags` VALUES (2, ‘root’, ‘link’, ‘’, 1, 2, ‘root’) in /home/…..info/textpattern/lib/txplib_db.php on line 81
2. Duplicate entry ‘2’ for key 1

Warning: Duplicate entry ‘3’ for key 1 INSERT INTO `txp_smd_tags` VALUES (3, ‘root’, ‘image’, ‘’, 1, 2, ‘root’) in /home/…….info/textpattern/lib/txplib_db.php on line 81
3. Duplicate entry ‘3’ for key 1

Warning: Duplicate entry ‘4’ for key 1 INSERT INTO `txp_smd_tags` VALUES (4, ‘root’, ‘file’, ‘’, 1, 2, ‘root’) in /home/………info/textpattern/lib/txplib_db.php on line 81
4. Duplicate entry ‘4’ for key 1
Textpattern
=============================

Offline

#9 2008-10-16 08:40:45

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,799
Website

Re: smd_tags: unlimited article, image, file and link taxonomy

jpdupont

Hello, that is baffling. I did find a small bug in the remove tables procedure (I left a table behind) and that’s fixed now, but that shouldn’t affect the installation.

So you got no other error messages on screen? No SQL warnings? Did you try it with your site in debugging mode to see if it gave any errors that might help me track this down?

If you download the latest version 0.11 [ zipped ], try putting this in your URL bar:

index.php?event=smd_tags&step=smd_tags_table_remove&debug=1

Run it and see what you get out. You should see:

++ TABLE smd_tags HAS 0 COLUMNS; REQUIRES 7 ++
++ TABLE smd_tags_cat HAS 0 COLUMNS; REQUIRES 2 ++
++ TABLE smd_tags_used HAS 0 COLUMNS; REQUIRES 3 ++

Then, instead of clicking Install tables, put this in your URL bar:

index.php?event=smd_tags&step=smd_tags_table_install&debug=1

Run it and see what you get out. You should see a whole hunk of SQL commands and then:

++ TABLE smd_tags HAS 7 COLUMNS; REQUIRES 7 ++
++ TABLE smd_tags_cat HAS 2 COLUMNS; REQUIRES 2 ++
++ TABLE smd_tags_used HAS 3 COLUMNS; REQUIRES 3 ++

If it’s any different from any of that, can you post what you see please (or e-mail it to me)? Also please let me know what versions of PHP and MySQL you have, and the TXP SVN revision you have installed. And if you can log into your MySQL database (or use the rss_admin_db_manager plugin), would you please check that there are three extra tables in your Textpattern database: smd_tags, smd_tags_used and smd_tags_cat.

I can’t make it fall over here, but then I’m using old PHP4 and MySQL4. Maybe things have changed in the v5 products and I need to track these subtle differences down. Thanks for your patience.

Last edited by Bloke (2008-10-16 08:50:31)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2008-10-16 13:30:20

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,799
Website

Re: smd_tags: unlimited article, image, file and link taxonomy

Many thanks to jpdupont who graciously gave me a login to test and fix what I’d done wrong.

And I had done wrong; I’d been inconsistently using the table prefix throughout the code and hadn’t spotted it because I don’t use a prefix. Tut tut, where do they get these rookie coders from? ;-)

Anyone who has downloaded admin v0.11 should go and grab the updated copy with the fixes in it (make sure you force refresh the link in case it’s been cached). Since I only half made a fix this morning I completed it now and re-issued it under the same name. Yeah I know, if I was doing it properly and using git I wouldn’t get away with it…

Apologies to anyone with prefixes on their tables who have been scratching their heads. That should get you going. I shall now humbly slink away and pretend I’m not crap.

Last edited by Bloke (2008-10-16 13:31:20)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB