Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#313 2007-11-11 14:34:17

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

Re: tru_tags: A tagging plugin for textpattern

andreas, after you installed 3.0, did you update the preference on the Extensions -> tru_tags page?

If so, does “stichwort” have any non-ascii characters in it? The problem is likely that I didn’t handle extended character sets correctly. Please let me know and I’ll look into it.

Offline

#314 2007-11-11 15:34:27

andreas
Member
Registered: 2004-02-28
Posts: 453
Website

Re: tru_tags: A tagging plugin for textpattern

I did update the preference and these are just plain letters “s – t – i – c – h – w – o – r – t”.

Offline

#315 2007-11-11 15:53:49

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

Re: tru_tags: A tagging plugin for textpattern

Well, I was completely ready to believe that this was a bug in tru_tags, but now I’m not so sure. I converted my test site to match yours, as follows:

I renamed my ‘tag’ section to ‘stichwort’

I updated my ‘if_section’ call on my default page to use ‘stichwort’

I updated the “Tag section name” preference in tru_tags to say ‘stichwort’

…and that worked.

I did make one minor change to the plugin, but that shouldn’t have affected this situation. Nevertheless, it’s probably a good idea for you to grab v3.0 again and see if it helps.

One more question – are you using clean urls?

Offline

#316 2007-11-11 16:17:59

andreas
Member
Registered: 2004-02-28
Posts: 453
Website

Re: tru_tags: A tagging plugin for textpattern

Doesn’t work with the new version either. I use clean URLs (section/title). Everything worked fine before the upgrade, I had tag-based URLs working: /stichwort/tag-name

All I changed was the plugin update.

Here’s the page of the tag-cloud

Offline

#317 2007-11-11 16:42:29

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: tru_tags: A tagging plugin for textpattern

I am deeply impressed. Good work Nathan!

the issue you reported with spaces at the end of the keywords field is actually a bug with the 4.0.5 release of Textpattern. I found the issue and reported it, and it has already been fixed for the next Textpattern release.

Thanks! Just checking the roadmap…


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#318 2007-11-11 16:46:12

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: tru_tags: A tagging plugin for textpattern

Higher priority for “Multi-tag search (tag1 + tag2)”?

  • Feature request: RSS feeds for tags
  • Feature request: boolean combinations :-) Example: (tag1 or tag2) and tag3
  • Feature request: Output the tag section as indexed pages (A-Z) to structure big amounts of tags. Examples can be seen here: SmashingMagazine (paragraph: Tag Index Instead Of Tag Clouds)

Last edited by merz1 (2007-11-11 16:55:55)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#319 2007-11-11 20:45:05

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

Re: tru_tags: A tagging plugin for textpattern

andreas – I’m still thinking that something might be funny about your site configuration. My clue is this:

This URL: http://www.rete-mirabile.net/?s=lernen seems to work,

but this URL: http://www.rete-mirabile.net/?s=stichwort doesn’t,

while this one: http://www.rete-mirabile.net/stichwort/ does.

As near as I can tell, tru_tags shouldn’t be touching that second URL, and Textpattern should just render the default page for your “stichwort” section. Presumably that should be the exact same page as the third URL, but it isn’t. Is there any chance that you have custom rewrite rules in your .htaccess file?

If that’s not it, the only thing I can think to try is to start putting debugging messages into tru_tags to see what it’s really doing. To do that, I’d need access to your site. If you’re willing to do that, please send credentials to truist-20071111@truist.com.

merz1 – thanks! For your feature requests:

  • Multi-search tag (in the current version of TXP) will require a major hack to work around the structure of the Textpattern code, so I’ve been avoiding it in the hope that future versions of TXP will be more modular. The fact that it’s as high on the priority list as it is, is a good sign :) Implementing that feature will also probably mean that I submit a major piece of code to Textpattern, to make the code be more modular.
  • Good reminder about RSS feeds for tags. That’s another one that’s waiting on better Textpattern code, although in this case I actually submitted the better code already, and it’s already committed to core, but I don’t think we’ll see it until the next major Textpattern release. I added this idea to the roadmap page, though, with an indication that it depends on the Textpattern release. Once we get that, though, this will be relatively easy.
  • I added the boolean combinations to the “multi-tag search” group – once multi-tag search is done, booleans should be relatively easy
  • The indexed output was already in “group 5”, but I added the idea of a single page per group.

Thanks!

Offline

#320 2007-11-16 10:37:41

iboi
New Member
Registered: 2007-11-16
Posts: 2

Re: tru_tags: A tagging plugin for textpattern

truist wrote:

All, I’m very pleased to announce the release of tru_tags v3.0.

I cannot reach your domain. Is there an alternative download location?

Offline

#321 2007-11-16 10:58:16

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: tru_tags: A tagging plugin for textpattern

iboi, here is the plugin code. Well it’s a little modified version, but it works completely same way. Only comments are removed from the plugin’s php-code :)

# tru_tags 3.0
# Article tagging
# Nathan Arthur
# http://www.truist.com/

# .....................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

YTo5OntzOjQ6Im5hbWUiO3M6ODoidHJ1X3RhZ3MiO3M6NjoiYXV0aG9yIjtzOjEzOiJOYXRoYW4gQXJ0aHVyIjtzOjEwOiJhdXRob3JfdXJpIjtzOjIyOiJodHRwOi8vd3d3LnRydWlzdC5jb20vIjtzOjc6InZlcnNpb24iO3M6MzoiMy4wIjtzOjExOiJkZXNjcmlwdGlvbiI7czoxNToiQXJ0aWNsZSB0YWdnaW5nIjtzOjQ6ImhlbHAiO3M6NjMwOiIJPHA+VG8gbGVhcm4gbW9yZSBhYm91dCB0cnVfdGFncywgY2hlY2sgb3V0IHRoZSA8YSBocmVmPSIvYmxvZy80OTMvdHJ1dGFncy1hLXRhZ2dpbmctcGx1Z2luLWZvci10ZXh0cGF0dGVybiIgcmVsPSJub2ZvbGxvdyI+aW50cm9kdWN0b3J5IGFydGljbGU8L2E+LCA8YSBocmVmPSJodHRwOi8vd3d3LnRydWlzdC5jb20vcmVmZXJlbmNlLzUzNy90cnVfdGFncy1yZWxlYXNlcyIgcmVsPSJub2ZvbGxvdyI+cmVsZWFzZXMgcGFnZTwvYT4sIDxhIGhyZWY9Imh0dHA6Ly93d3cudHJ1aXN0LmNvbS9yZWZ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c3RhcnQoIiosIHVuaXhfdGltZXN0YW1wKFBvc3RlZCkgYXMgdVBvc3RlZCIsICd0ZXh0cGF0dGVybicsDQoJCSR3aGVyZS4gJyBvcmRlciBieSAnIC4gZG9zbGFzaCgkc29ydGJ5KSAuICcgJyAuIGRvU2xhc2goJHNvcnRkaXIpIC4gJyBsaW1pdCAnIC4gZG9TbGFzaCgkbGltaXQpKTsNCg0KCXJldHVybiAkcnM7DQp9DQoNCg0KIjtzOjQ6InR5cGUiO3M6MToiMSI7czozOiJtZDUiO3M6MzI6IjFmOGUwNzdmYjYyZWM1YTNiNDExN2NiYWFhYTMyNzE4Ijt9

Cheers!

Last edited by Gocom (2007-11-16 10:59:21)

Offline

#322 2007-11-16 11:27:04

iboi
New Member
Registered: 2007-11-16
Posts: 2

Re: tru_tags: A tagging plugin for textpattern

Gocom wrote:

iboi, here is the plugin code. Well it’s a little modified version, but it works completely same way. Only comments are removed from the plugin’s php-code :)

Thank you very much! Still waiting for the domain to resolve since the intructions are also available there.

Offline

#323 2007-11-16 11:58:50

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

Re: tru_tags: A tagging plugin for textpattern

Sorry, folks. The server is down, but it should be back up later this morning. Thanks for posting the code, Gocom.

Offline

#324 2007-11-20 20:56:13

andreas
Member
Registered: 2004-02-28
Posts: 453
Website

Re: tru_tags: A tagging plugin for textpattern

Sorry, for some reason the e-Mail notification of this thread didn’t work so I only noticed your post just now.

truist wrote:

Is there any chance that you have custom rewrite rules in your .htaccess file?

No – none that would interact with the “stichwort” section.

If that’s not it, the only thing I can think to try is to start putting debugging messages into tru_tags to see what it’s really doing. To do that, I’d need access to your site. If you’re willing to do that, please send credentials to truist-20071111@truist.com.

Send you account info. Thanks for taking the time to look into it.

Offline

Board footer

Powered by FluxBB