Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2008-10-17 15:01:02

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

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

Thanks Stef. Changes made to code and all seems to work as expected.

I’ll go and work on that CSS now.

I haven’t tried anything on the client-side yet due to the currently needed hack. I’ll get around to it eventually.


Stuart

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

Offline

#22 2008-10-17 15:05:45

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,665
Website

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

thebombsite wrote:

Changes made to code and all seems to work as expected.

Ace.

I’ll go and work on that CSS now.

Ace ^2.

I haven’t tried anything on the client-side yet due to the currently needed hack.

OK, no probs. The hack is only for images. And in fact only if you want to run the smd_related_tags or smd_tag_list from_within_ an images form, which you currently can’t do due to lack of the $thisimage context.

I put together another patch last night with a heavily reduced tag set (6 tags compared to, like 17 in the 1st submission!) and I’m running it through some testing to see if it allows all of the functionality people might require. Hopefully should be submitted for approval/further testing over the weekend if I get some time.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#23 2008-10-17 15:12:06

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

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

OK. Let me know when it’s ready and I’ll give it a whirl. Forgot it only applied to certain image tags. :(

And when you have some spare time don’t forget to move that site of yours into a decent CMS. :)


Stuart

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

Offline

#24 2008-10-17 15:33:00

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
Website

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

Hey, while you’re at it… ;) how about a global category for all content types.

That would totally simplify the set up for the client section detailed here.

Seriously though… outstanding work, cholo.

Offline

#25 2008-10-17 15:41:26

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,665
Website

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

mrdale wrote:

Hey, while you’re at it… ;) how about a global category for all content types.

Welcome to xPattern :-)

EDIT: Actually, that might be doable. Hmmm…. *stef dons his deviant coder's hat*

Last edited by Bloke (2008-10-17 15:44:18)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#26 2008-10-17 16:23:47

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
Website

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

BTW: I realize that every time you release something brilliant, I immediately say “Oh hay. Can haz X and Y?”

Offline

#27 2009-01-11 19:12:11

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 985
Website

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

Howdy!

I’m testing the smd_related_tags tag, and I keep getting the following errors:

Notice: Undefined variable: uLastMod  on line 906
Notice: Undefined variable: uExpires  on line 929

Here’s the tag generating the error:

<txp:smd_related_tags type="article" section='<txp:section />' label="Possibly related" labeltag="h3" wraptag="ul" break="li" />

I get the same errors if I add match="keywords" attribute.

Did I do something wrong in the setup phase? I’m running TXP 4.0.7 with MySQL 5.0.41.

Offline

#28 2009-01-11 19:52:04

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 985
Website

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

I think I found the solution— thanks, Stef!

I edited the client-side plugin, replacing uPosted with uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod all the way, and the error messages went away. Hopefully this is a healthy, wholesome solution that won’t destroy me down the road. ;)

Offline

#29 2009-01-12 02:43:31

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 985
Website

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

from Admin help:

Default section for tags : Any links from the client-side tags will be sent to this section for display. Can be overridden on a tag-by-tag basis with the section_link attribute.

This sounds like the smd_tags analogue to <txp:tru_tags_handler />, but I can’t figure out how to configure out how to configure a landing page for tag links.

With tru_tags, my setup worked like this:

<txp:if_section name="tags">
	<txp:tru_tags_handler />
	<txp:else />
	// content //
</txp:if_section>

What’s the proper way to setup smd_tags’s default section? I’ve tried something akin to this:

<txp:if_section name="tags">
	<txp:smd_tag_???>
			<h3><txp:title /></h3>
			<txp:rss_auto_excerpt paragraphs="1" />
	</txp:smd_tag_???>
	<txp:else />
	// content //
</txp:if_section>

smd_if_tag_list

Conditional tag that returns true if the current scope is a global tag list. Useful for detecting if a tag has been clicked and redirected to a landing page so you can take some action on that page.

From this snippet, I thought smd_if_tag_list was the tag to use here, but I haven’t found the correct way to get it working.

I would be grateful for any guidance offered on this! Thanks!

Last edited by johnstephens (2009-01-12 02:47:39)

Offline

#30 2009-01-15 00:22:04

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,665
Website

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

johnstephens wrote:

What’s the proper way to setup smd_tags’s default section?

Hi John, sorry for the delay in getting back to you. The main difference between smd_tags and tru_tags in this regard is that you do not need a handler in smd_tags. It is automatic.

First of all, go to the plugin prefs and make sure you set up the name of a section to be your landing page. You can leave URL name parameter and URL type parameter alone for now.

Let’s say you chose smd_tags as your default page. Create a section smd_tags and assign it a Page. It could be the same Page as you already use; in which case you need to use the conditional <txp:smd_if_tag_list>... your tag shenanigans...</txp:smd_if tag_list> to separate it from your regular content. If this is a dedicated page template in a dedicated section you don’t need to use the conditional tag, though it’s probably good practice.

OK, so inside your conditional you might put something like this:

<h2>Tags list</h2>
<txp:smd_tag_list>
  <txp:smd_tag_name title="1" link="1" />
  <txp:smd_tag_count />
  <txp:smd_related_tags wraptag="ul" break="li">
    <txp:smd_if_tag type="file">
       <txp:file_download_link><txp:file_download_description /></txp:file_download_link>
    </txp:smd_if_tag>
  </txp:smd_related_tags>
</txp:smd_tag_list>

Phew! That uses <txp:smd_tag_list /> as a container and outputs all tags of the given type. It shows the tag name and its article count, then it goes away and looks for all related tags that share the current (article) tag name. It assembles a complete list of those behind its back and the conditional <txp:smd_if_tag type="file"> takes a look at each one. If it is a tag associated with a file, it displays the download description of that file. If it’s a tag of any other type (link, image, article) it ignores it.

That’s all well and good but how do you give it a starting point? That’s where the URL comes in:

site.com/smd_tags/article

will show all article tags and — if they share any tags with files — will show those too as a list.

site.com/smd_tags/file

will show all file tags and — if they share any tags with other files — will show those too as a list. And so on.

site.com/smd_tags/article/tiger

will show the article tag ‘tiger’ and — if any files also have the tag “tiger” — will show those as a list.

In this way, you can construct URLs that allow you to browse tags in a way that makes sense to your visitors. For example, if you have a traditional article and have tagged it with tiger big stick poke roar chomp ouch hospital you could list all the tags under your article in your article form:

<txp:permlink><txp:title /></txp:permlink>
Filed in: <txp:category1 link="1" title="1" />
Tags: <txp:smd_tag_list><txp:smd_tag_name link="1" title="1" /></txp:smd_tag_list>

That makes a clickable link from each tag to your default tag section. So, in theory (you’ll see why in a sec) if you click on “roar” it will take you to the URL site.com/smd_tags/article/roar and on that Page you can do whatever you want: list other articles with the same tag, list other files that share the tag (like the example above), list other links that have the same category as the given tag. The sky’s the limit.

Well, it would be, except I think the URL scheme is broken :-( At least it’s broken in my dev copy. It might be because I killed it with something I did as I’m developing v0.2 or it could be that it’s also broken in v0.11.

In v0.11, the link="1" creates ‘messy’ URLs that use those other two attributes in the smd_tags prefs. It then makes links like:

site.com/smd_tags?smd_tagtype=article&smd_tag=roar

Behind the scenes the plugin is supposed to figure out what that means and present the correct list as if you’d done it with a clean URL. But I don’t know if it does. If not you can still make it work by manually constructing clean URLs in your anchors, but it’s a hassle you could do without. Taking the current permlink mode into account is slated for v0.2 (now I understand it all a bit more!)

YMMV: it might work as indicated above or may not. I know of a few other people using v0.11 and they’ve not complained so perhaps it is working; or perhaps they’re not using it in this way.

If it doesn’t work I will do my level best to get v0.2 out asap. I’m snowed under with a client site right now but should be clear in a few weeks. I know I’ve been promising this one for ages and I’m sorry it’s not quite all there but I’ll try and get this darn plugin singing like it should as soon as I can.

Does that give you any ideas or have I completely flummoxed you now? :-)

Last edited by Bloke (2009-01-15 00:24:55)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB