Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#151 2011-06-04 16:06:07
Re: smd_tags: unlimited article, image, file and link taxonomy
Dwayne wrote:
thanks for this plugin.
No worries. Hope we can get it to work for you. I do need to desperately revisit this plugin and make it a little lighter on the query count. It’s not particularly clever when dealing with lists of tags right now, but I have some notions on how to fix it.
Most likely the problem is that there are no URL params, right?
If you are using smd_related_tags on its own, then yes. If you want to bypass the URL structure you need to wrap your other smd_tags tags(!) in <txp:smd_tag_list type="image">. That should put it in the right context.
However I’m not sure how successful that will be since it still won’t ‘know’ which images you want to display. This might take some brain power, and I don’t have time to sit down and figure out something better right now. My first stab would be something along these lines, although it’s not exactly efficient:
<txp:images break="">
<txp:hide> Grab all images...</txp:hide>
<txp:smd_if_tag name="front-page">
<txp:hide> ... and filter out only those with the 'front-page' tag</txp:hide>
<txp:thumbnail />
</txp:smd_if_tag>
</txp:images>
Downside: as your image count goes up, so will the length of time it takes to process the list. If you could somehow filter the images list first — maybe by category or something — that would help.
I’m sure there must be a better way of only grabbing the images that match a given tag; probably using smd_tag_list and/or smd_related_tags. Sadly, at the moment, they’re probably just as inefficient so you might as well stick with the method above! When I get back to looking at this plugin I’ll certainly consider this use case and see if I can make it better. Thanks for giving me a nudge.
Last edited by Bloke (2011-06-04 16:08:01)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#152 2011-06-08 20:23:58
- Dwayne
- New Member
- From: Hamburg, Germany
- Registered: 2008-11-09
- Posts: 7
Re: smd_tags: unlimited article, image, file and link taxonomy
Ok, i surrender… No way for me to get these images displayed as expected. With your method, Bloke, TXP displays all of my images. I also wasn’t able to identify any rule that would explain the randomness in which TXP displays those images. And even with only some images the request took too much time, as you already predict.
For now I’ll deal with the common categories, but I’m really looking forward for the adaption of this plugin… Thanks again for you help. I’ll keep track on this plugin… :-)
Offline
#153 2011-07-16 17:20:29
- frickinmuck
- Member

- Registered: 2008-05-01
- Posts: 118
Re: smd_tags: unlimited article, image, file and link taxonomy
I am using this most beloved plugin (thanks!) on a site, and when I try to output a list of tags associated with an article, I get this error:
Tag error: <txp:smd_tag_list showall="1" sort="name asc"
break="" wraptag="div"> -> Warning: Invalid argument supplied for foreach() on line 2390
textpattern/lib/txplib_misc.php(653) : eval()'d code:2390 smd_tags_context()
textpattern/lib/txplib_misc.php(653) : eval()'d code:3254 smd_tags_context()
textpattern/publish.php:1188 smd_tag_list()
textpattern/publish.php:1113 processtags()
textpattern/lib/txplib_misc.php:1706 parse()
textpattern/publish/taghandlers.php:314 parse_form()
textpattern/publish.php:1188 output_form()
textpattern/publish.php:1100 processtags()
textpattern/publish.php:538 parse()
index.php:45 textpattern()
This is being generated by the sidebar taglist. The error doesn’t appear when I remove the “related tags” list from the article, though. It only appears when I have both the article list of related tags and the sidebar list of all tags.
EDIT: I think it’s something to do with the implementation of the plugin and the URL structure of my site. It’s using clean Section/ID/Title URLs, and I haven’t figured out what I need to enter in the trigger area to get it working correctly.
Last edited by frickinmuck (2011-07-16 21:57:44)
The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.
Offline
#154 2011-07-16 22:22:23
Re: smd_tags: unlimited article, image, file and link taxonomy
frickinmuck wrote:
The error doesn’t appear when I remove the “related tags” list from the article
Hmmm, maybe the tag_list in the sidebar is destroying the ‘context’ of the related tags (or vice versa). Would you mind sharing your tag code for both article and sidebar so I can try your setup directly on my server. I guess the sidebar code is the same as that shown in the error block you posted above, but I’d like to try it as you have it now, in case you’ve tweaked it since.
It’s using clean Section/ID/Title URLs, and I haven’t figured out what I need to enter in the trigger area to get it working correctly.
Double hmmm, I can’t recall trying it with that permlink structure: perhaps an oversight on my part. Can’t see why it would complain though, but anything’s possible. I’ll test it and see if I can figure this out.
Last edited by Bloke (2011-07-16 22:33:29)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#155 2011-07-16 22:56:38
- frickinmuck
- Member

- Registered: 2008-05-01
- Posts: 118
Re: smd_tags: unlimited article, image, file and link taxonomy
Ah, thanks! Here’s the sidebar code:
<txp:smd_tag_list showall="1" sort="name asc"
break="" wraptag="div">
<txp:if_different>
<h2 class="alphachar"><txp:smd_tag_info item="lettername" /></h2></txp:if_different>
<span class="atag">
<txp:smd_tag_name link="1" wraptag="span" />
<txp:smd_tag_count /><br />
</span>
</txp:smd_tag_list>
And here’s the article code:
<div class="tag-display">Tags: <txp:smd_related_tags type="article" wraptag="span" break="," /></div>
I’m using this in the blog section of a site, and I had added “blog” as the trigger. I think that’s the most likely area where something could be going wrong, as I admit I don’t understand that setting at all. :^)
The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.
Offline
#156 2011-07-16 23:35:23
Re: smd_tags: unlimited article, image, file and link taxonomy
frickinmuck
Thanks for the code. It works fine on my site but then I’m using the in-development version which may have fixed any bugs in v0.40.
Having said that, I have not set it up with my ‘blog’ section as the trigger. And you’re right, that may be the problem so let’s explore that first.
The trigger(s) are — at their simplest — sections of your site that you want to treat as ‘tag list’ pages. So if you set the trigger to blog, taglist then visiting either site.com/blog or site.com/taglist would trigger ‘tag mode’. Tag mode allows you to filter tags by the URL, e.g. site.com/taglist/muppets would give you info about the article ‘muppets’ tag. site.com/taglist/image/muppets would give you info about the image ‘muppets’ tag. On the landing page of that section, you can put smd_tag_list tags and other smd_tag display tags to format the output — show counts, links to other tags, articles, whatever.
In your case, setting your trigger to ‘blog’ probably means that visiting a real article at site.com/blog/42/the-meaning-of-life triggers smd_tags to wake up. It looks at the URL, sees 2 portions after the ‘blog’ bit and assumes they are the tag type and tag name, respectively. Thus it tries to display info about the tag called ‘the-meaning-of-life’, of type ‘42’. Since ‘42’ is not a valid tag type (you need to use article, image, file or link) the plugin’s probably just collapsing into a pile of broken 1s and 0s.
I should guard against that actually so it doesn’t error out — I’ll see if I can do that. But in the meantime, try setting your trigger to some section you intend to dedicate to URL-based tag trickery, or just empty that setting out and try again.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#157 2011-07-17 00:29:56
- frickinmuck
- Member

- Registered: 2008-05-01
- Posts: 118
Re: smd_tags: unlimited article, image, file and link taxonomy
Thanks for the explanation – I can see why that’s confusing things. When I empty the trigger field the error goes away, but the sidebar tags are generating this type of URL: http://article/sample-tag, which of course isn’t going to work.
However, I noticed another thing – my article tags lists aren’t actually showing the tags, they’re displaying as the article title instead. So, instead of getting “Sample Tag 1” “Sample Tag 2” I’m getting “Sample Blog Post 1” “Sample Blog Post 2”. The links associated with those tags take you to the article (as in, /blog/60/sample-blog-post). This is happening whether the trigger field is empty or not.
Edit: I should add that /blog/article/sample-tag doesn’t work, nor does article/sample-tag, regardless of what I have in the trigger field.
Last edited by frickinmuck (2011-07-17 00:34:52)
The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.
Offline
#158 2011-07-17 20:15:00
Re: smd_tags: unlimited article, image, file and link taxonomy
frickinmuck wrote:
When I empty the trigger field the error goes away, but the sidebar tags are generating this type of URL: http://article/sample-tag, which of course isn’t going to work.
I could probably be more clever about this — for example, default to the current section if the triggers are empty instead of rendering two slashes without anything between them — but it really comes down to what you actually want the visitor to see when they click a tag. What do you want to happen? If we start there and work back it’ll be easier than me proposing things that you probably don’t want.
my article tags lists aren’t actually showing the tags, they’re displaying as the article title instead.
I should have spotted this earlier but my brain was foggy last night: I think this is because you’re using <txp:smd_related_articles />. That tag fetches a list of articles that have the same tags as those in the current article, and displays permlinks to them. If you want to display a hyperlinked list of tags that are in the current article you should try this approach in your article Form:
<div class="tag-display">Tags:
<txp:smd_tag_list wraptag="span" break=",">
<txp:smd_tag_name link="1" />
</txp:smd_tag_list>
</div>
Your tag will be hyperlinked, but they’ll also have the double slash thing in the URLs unless you add at least one trigger section (i.e. a destination tag landing page), or you override the behaviour with the section="some_section" attribute in <txp:smd_tag_name />. Is that sort of making sense? Again, we can look at what you actually want to happen when a visitor clicks a tag and work backwards to figure out the tags and settings you’ll need to accomplish it.
Last edited by Bloke (2011-07-17 20:16:04)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#159 2011-07-17 20:25:06
- frickinmuck
- Member

- Registered: 2008-05-01
- Posts: 118
Re: smd_tags: unlimited article, image, file and link taxonomy
Cool – I’ll try this, thanks. What I want to happen is, when someone clicks on a tag they get all the articles associated with that tag. Similar in functionality to txp:author, for example.
The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.
Offline
#160 2011-07-17 20:48:48
Re: smd_tags: unlimited article, image, file and link taxonomy
frickinmuck wrote:
when someone clicks on a tag they get all the articles associated with that tag.
Then you’ll need a landing page (a.k.a. trigger) set up in the prefs. Simplest method is to create a dedicated section for it: for the sake of argument I’ll call it tags. Set up the trigger and then create a section called tags. In the Page template for that section put this somewhere in your page flow:
<txp:smd_if_tag_list>
<txp:smd_tag_list wraptag="" break="">
<h2>Articles that match tag '<txp:smd_tag_name title="1" />'</h2>
<txp:smd_related_tags wraptag="ul" break="li" section="" />
</txp:smd_tag_list>
</txp:smd_if_tag_list>
That’ll get you going. The section="" is necessary because smd_related_tags defaults to grabbing matching articles from the current section and we want to get articles from all sections (because section ‘tags’ is bogus, just used for the sake of the tag list).
Last edited by Bloke (2011-07-17 20:50:26)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#161 2011-07-17 21:04:56
- frickinmuck
- Member

- Registered: 2008-05-01
- Posts: 118
Re: smd_tags: unlimited article, image, file and link taxonomy
Eureka! It’s working now! My hero!
The only issue I’m having now is that error is back:
Tag error: <txp:smd_tag_list showall="1" sort="name asc"
break="" wraptag="div"> -> Warning: Invalid argument supplied for foreach() on line 2390
That has to be something with the sidebar, I’m assuming? it shows up in the blog section. Here’s the code I’m using for the tags page:
<txp:smd_if_tag_list>
<txp:smd_tag_list wraptag="" break="">
<h2>Articles that match tag '<txp:smd_tag_name title="1" />'</h2>
<txp:smd_related_tags form="blog_listing" section="" />
</txp:smd_tag_list>
</txp:smd_if_tag_list>
For the article tag lists:
<div class="tag-display">Tags:
<txp:smd_tag_list wraptag="span" break=",">
<txp:smd_tag_name link="1" />
</txp:smd_tag_list>
</div>
For the sidebar list:
<h1 class="sidebar-title">Tags</h1>
<txp:smd_tag_list showall="1" sort="name asc"
break="" wraptag="div">
<txp:if_different>
<h2 class="alphachar"><txp:smd_tag_info item="lettername" /></h2></txp:if_different>
<span class="atag">
<txp:smd_tag_name link="1" wraptag="span" />
<txp:smd_tag_count /><br />
</span>
</txp:smd_tag_list>
EDIT: Plugin prefs:
URL name parameter: tag
URL type parameter: tagtype
Trigger: tags
Last edited by frickinmuck (2011-07-17 21:09:29)
The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.
Offline
#162 2011-07-17 21:43:21
Re: smd_tags: unlimited article, image, file and link taxonomy
frickinmuck wrote:
Eureka!
Glad we’re starting to cook.
The only issue I’m having now is that error is back:
That is totally weird because I cant replicate it on my server using your exact code and setup. I wondered if it might be the fact that your sidebar might come after the article’s tag list so I switchd it round so the ‘all’ tag list came after my <txp:article /> tag in the Page template. I still didn’t get the error.
I even put the tag list inside the article form: still worked. And I just checked the code and there’s no reason the new version of the plugin (at the moment at least) would behave any differently in this regard because the only changes have been minor jQuery tweaks to the admin side.
Totally freaky. I honestly don’t know what to suggest aside from maybe dropping me a login to your site so I can dig around and put some debug stuff in the code to try and see why yours is behaving differently to mine. If it’s a live or local site I guess that’s probably out of the question, but if you don’t mind doing that then it might be the fastest way to get to the bottom of this.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#163 2011-07-18 00:01:47
- frickinmuck
- Member

- Registered: 2008-05-01
- Posts: 118
Re: smd_tags: unlimited article, image, file and link taxonomy
Meh, that’s OK. It’s working, and that’s all I really care about. Thanks for all your kind assistance – you’ve been a massive help to me these past couple of weeks! I’ve got, like, 7 of your plugins on this site.
The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.
Offline
#164 2011-08-01 20:15:44
Re: smd_tags: unlimited article, image, file and link taxonomy
Trying this plugin out stef, thanks for your work on it! I want to be able to page tag results which you can’t do with tru_tags, but that is not related to my issue.
When I use tagging within an article with text list, textarea or textarea+ the currently assigned tags do not show bold as in the text list or in the textarea’s there is never any text unless I type it in.
however when I go to extensions -> manage tags the tags I typed in are there and associated with the article but I can’t remove them because they don’t show in the textarea in the write tab…
It does work when in select list mode though. The proper tags are highlighted and can be removed if desired.
Any ideas?
I would also like to request the tru_tags display option of a textarea with a text list below to select from, just add the warning that if you use thousands of tags it is going to be sloooooooooow!
thanks stef in advance
Offline
#165 2011-08-03 10:11:47
Re: smd_tags: unlimited article, image, file and link taxonomy
Hi Stef and thanx for a great plugin! (and all your other fantastic plugins!)
I’m looking for a way to “infuse” a tag (or category if you’d like) to the related_tags tag to show a box displaying articles from one of the tags.
I’m not sure if I’m making myself clear but what I’m looking for is a equivalent tag for the txp:rss_uc_article_list so I don’t have to use both smd_tags and rss_unlimited_categories….
Anyone tried/managed to do this?
Offline