Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#376 2018-02-25 12:09:29

jpdupont
Member
Registered: 2004-10-01
Posts: 752

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

Thank you Stef. I will look at the last suggestion with <txp:smd_related_tags/>.

On the other hand, is my solution with <txp:evaluate /> (which works correctly) a somewhat twisted use of evaluate, and too greedy in resource? Or the <txp:evaluate /> code optimizes all this?

Offline

#377 2018-02-25 13:23:11

etc
Developer
Registered: 2010-11-11
Posts: 5,683
Website GitHub

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

jpdupont wrote #309426:

On the other hand, is my solution with <txp:evaluate /> (which works correctly) a somewhat twisted use of evaluate, and too greedy in resource? Or the <txp:evaluate /> code optimizes all this?

The multiple queries seem expansive, and <txp:evaluate /> does not help in any way here. I would rather try to extract everything in one go as suggested by Stef, but the only way to be sure is test and look at the debug info.

Offline

#378 2018-02-25 19:06:32

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 727
Website Mastodon

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

First of all a big thank you to you, Stef, for this awesome plugin. I will make sure to meet your donation button soon again. But then

debeo wrote #302925:

If anyone would be so kind to explain probably obvious thing that I can’t grasp.

I have articles under many sections and want to show them all under particular tag to which are they assigned. What do I do with ‘URL name parameter’ if I have something like this…
<txp:smd_if_tag> <txp:smd_related_tags type="article" match="tag_name" wraptag="ul" break="li"> <txp:permlink><txp:title /></txp:permlink> </txp:smd_related_tags> </txp:smd_if_tag> ?

I am having the same problem. I display a tag tree somewhere and want to display a list of articles using a one particular tag, when clicking on that respective tag in the tree. (Bloke’s fix below your post didn’t work here).
Using smd_tags 0.60 fresh installed today on a txp 4.6.2.

I am using

<txp:smd_if_tag_list auto_detect="0" type="article"> <txp:smd_if_tag> <txp:smd_related_tags section="music" type="article" match="tag_name" wraptag="ul" break="li" /> <txp:permlink><txp:title /></txp:permlink> </txp:smd_if_tag> </txp:smd_if_tag_list>

as part of an article form.
This article is entitled “results”, has a section “filter”, which is what i told smd_tags to use to construct tag links (smd_tag_u_sec).
When i call that article i [edit…] as an article_custom with above form applied, like in <txp:site_url />/filter/article/band i get not just articles tagged with “band”, but all articles in section music (like called in form above). Though not the articles, which didn’t use any tag at all. That seems to show, that there is some recognition of the form code… [/edit]

Anyhow, a tag doesn’t seem to play a role in the detection of the results.

Is it wrong to use the smd code above as part of an article form?

Where is my error?

Last edited by jayrope (2018-02-25 23:51:15)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#379 2018-02-26 14:14:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

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

jayrope wrote #309430:

I display a tag tree somewhere and want to display a list of articles using a one particular tag, when clicking on that respective tag in the tree.

This should be pretty standard functionality in smd_tags. First of all, a few things to note/questions:

  • When you say you display the tag tree “somewhere”, where is that exactly? In the Page template of your filtersection? How’s it being displayed? (what tag code?)
  • Why are you putting an article in the filter section and results code in an attached Form? I mean, it might work (in theory) but I’m not sure if Txp’s internal proccessing will get in the way (which might in fact have a bearing on your other query). It’ll probably depend on your use of <txp:if_individual_article> / <txp:if_article_list> and where the tag tree is displayed in the page flow.

That second point requires exploration. When Txp encounters your filter section it’ll load a given Page/Style as a “landing page” (a.k.a. list page / not an individual article page). The plugin wakes up, since the URL matches, and it’ll look at the remainder of the URL to determine if you’re viewing an individual tag:

  1. If not (example.com/filter) it should be instructed in your page template to render a tag list, either all tags, tags from a parent, used/unused/whatever. That allows visitors to click tags in the tree to see more.
  2. If individual tags are given (example.com/filter/article/tag1+tag2+tag3+...) then your page should detect this situation and use <txp:smd_related_tags> to fetch all articles that match the given tag(s).

Notice in the above two situations that under no conditions is an article called. As far as the plugin is concerned, there is no individual article view on a tag page.

So, by the time Txp gets involved – after the plugin has checked the URL status – and Txp decides to try an individual article, it’ll find your results page and dutifully render it. But all the tag stuff that the plugin set up might become confused because it’s not a list any more. I’m not sure, never really tested it that far as it’s not how I envisaged it to be used.

What you could do in situation 2 above, inside the <txp:smd_if_tag>, is put your article_custom there to load the article, display some top and tail content and then somewhere sandwiched in the middle, call the result form to display the tag contents/related articles. That might work a bit better.

<txp:smd_if_tag_list auto_detect=“0” type=“article”>

There are no such attributes to this tag. Check the plugin docs for details.

If you’re still stuck, post the relevant parts of your page/form template code and I’ll see if I can figure out what’s going on.


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

#380 2018-02-26 14:44:16

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 727
Website Mastodon

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

Bloke, thank you for coming back to this.

I display a sitemap (made from tags) in an article called sitemap, which is not part of my trigger section (the trigger section is called filter).
This is obviously my first mistake.
That sitemap/tag tree displays correctly.
The links of the tags follow the scheme site_url/trigger_section/article(from type)/tag
My landing page in the trigger section “filter” uses just a form with a content like this

<txp:smd_tag_list type="article"> <txp:smd_tag_info item="name" /> - <txp:smd_if_tag_list auto_detect="0"> <txp:smd_if_tag> <txp:permlink><txp:title /></txp:permlink> <txp:smd_related_tags section="music" type="article" match="tag_name" wraptag="ul" break="li" /> <br /> <txp:else /><txp:title /> has no tags, <txp:permlink>please edit</txp:permlink><br /> </txp:smd_if_tag> </txp:smd_if_tag_list> </txp:smd_tag_list>

I understand, that there is no article form used anywhere, so i go that way first.
… and report back. Thanx much!

Last edited by jayrope (2018-02-26 14:49:47)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#381 2018-02-26 15:18:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

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

jayrope wrote #309444:

I display a sitemap (made from tags) in an article called sitemap, which is not part of my trigger section (the trigger section is called filter). This is obviously my first mistake.

Not necessarily. You can display tag lists anywhere you like, in any section.

What you can’t do is use the <txp:smd_if_tag_list> to query the URL and see if you’re on a tag landing page, unless you’re on the section that you’ve designated in the smd_tags prefs as the one where you process tags. If you try and use that conditional tag on any other page, the tag will just shrug its shoulders and skip past it (or always do its ‘else’ branch) because the plugin’s URL handler isn’t invoked, thus it has no frame of reference to know what a tag list page is.

The reason for this, btw, is that the URL handler is pretty query-intensive so I constrained it to run only in one place for your vistors’ sanity and PageSpeed scores :-)


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

#382 2018-02-26 15:49:11

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 727
Website Mastodon

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

Well what i had in mind is tagging all articles with as many tags as i want to, then get these lists:

1. a tree of all tags with use counts, each tag entry linking to (working here, from your Example 1 in plugin help)
2. it’s own (single tag) list containing the titles of article assigned to respective tag (not working here).

I moved both 1. and 2. into the same form in the trigger section to avoid section confusion.
Can you five me a hint for which code i should use to achieve 2.?

i suppose both 1. and 2. could be a single output_form called when accessing the filter section?

I’m confused. I was hoping to let go of categories and instead use smd_tags to be able to create a sort of ever-growing network of tags and their respective entries.

Last edited by jayrope (2018-02-26 15:54:22)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#383 2018-02-26 15:51:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

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

jayrope wrote #309448:

I was hoping to let go of categories and instead use smd_tags to be able to create a sort of ever-growing network of tags and their respective entries.

That’s precisely what the plugin is for, so this’ll just be a configuration teething issue. I’ll try and set up my site to make it work in a similar way you have and post my code.


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

#384 2018-02-26 16:08:19

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 727
Website Mastodon

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

[Thank you, Stef, I sent you some flowers.]

Maybe it helps to know, that the plugin parts in an article write form here show “smd_tag_title” as well as [smd_tag_clear] & [smd_tag_toggle], those last two without link to them.
Confused plugin?

Last edited by jayrope (2018-02-26 16:08:46)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#385 2018-02-26 16:12:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

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

jayrope wrote #309451:

I sent you some flowers.

Awesome, received with thanks.

“smd_tag_title” as well as [smd_tag_clear] & [smd_tag_toggle], those last two without link to them.

Probably some language strings not loaded properly. Might be an issue with the 0.60 version, I’ll check, thanks for letting me know.


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

#386 2018-02-26 16:55:25

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 727
Website Mastodon

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

Add-on: A tag error shows up as well in debug mode on my trigger page:

Tag error: <txp:smd_related_tags section="music" type="article" match="tag_name" wraptag="ul" break="li" /> ->  Textpattern Error: Unknown column 'position' in 'field list' while parsing form sitemap_results_2 on page default
textpattern/lib/txplib_db.php:409 trigger_error()
textpattern/lib/txplib_db.php:1096 safe_query()
textpattern/lib/txplib_misc.php(1782) : eval()'d code:3921 getRows()
smd_related_tags()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()
textpattern/lib/txplib_publish.php:514 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:463 processTags()
textpattern/lib/txplib_misc.php(1782) : eval()'d code:3522 parse()
smd_if_tag()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()

Last edited by jayrope (2018-02-26 16:57:07)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#387 2018-02-26 17:26:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

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

jayrope wrote #309454:

Add-on: A tag error shows up as well in debug mode on my trigger page:

Argh! I forgot about that, sorry. I should update my site to use the patched version. I’ll do that (EDIT: updated).

That might be why things aren’t going your way. But anyway, here’s how I set things up in my test environment after applying the error-free plugin to the site (and installing the textpack without its “@#language en” line. For some reason, the pack didn’t get installed properly during installation. I’ll fix that too. EDIT: fixed in above download).

Sections:
  • articles, default, filter
Pages:
  • default (assigned to section: default)
  • tag_results (assigned to section: filter)
Articles:
  • A bunch of articles containing band names or artists. Prodigy, Chemical Brothers, LeAnn Rimes, Dumpy’s Rusty Nuts, etc. Each band was assigned tags from the following list:
Tags:
  • Artist
  • Band
  • Country
  • Dance
  • Easy listening
  • Rock

I didn’t bother categorising the tags or setting up a hierarchy for now.

I changed one smd_tags pref:

  • Trigger(s) for tag lists = filter

In my tag_results Page:

<html>
<head>
<title>Music tag list</title>
</head>
<body>
<txp:smd_if_tag_list>
  <txp:smd_tag_list>
    Other articles with tag <txp:smd_tag_name title="1" link="1" />
    <txp:smd_tag_count />
    <txp:smd_related_tags section="articles" wraptag="ul" break="li" />
  </txp:smd_tag_list>
  Show <a href="<txp:site_url /><txp:section />">all tags</a>.
<txp:else />
  <h2>All tags</h2>
  <txp:smd_tag_list showall="1">
    <txp:smd_tag_name title="1" link="1" />
    <txp:smd_tag_count />
  </txp:smd_tag_list>
</txp:smd_if_tag_list>
</body>
</html>

In my default Form I have the usual <txp:body />, <txp:excerpt />, <txp:posted /> tags, but I ripped out the chunk where the category info was displayed and replaced it with:

        <txp:smd_if_tag>
           <txp:smd_tag_list>
              <txp:smd_tag_name link="1" /> <txp:smd_tag_count />
           </txp:smd_tag_list>
        </txp:smd_if_tag>

That’s it. Navigating to an article shows me a list of clickable tags it contains. Clicking one takes me to the /filter/article/<tagname> page which shows me the tag name and then a list of all articles that contain the tag. Clicking one of those articles takes me to the article in question, which shows its tags, and so on…

Just for a laugh, I also added a link at the bottom of the tags-with-articles list to show an ‘all tags’ list (which is handled by the ‘else’ portion of the code in the tag_results page).

All works swimmingly. Hope that helps get you going.

P.S. This has highlighted that:

a) The plugin documentation is bad and needs rewriting in the next version.
b) I need more examples in the docs, like the above.

Last edited by Bloke (2018-02-26 17:36:34)


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

#388 2018-02-27 10:39:50

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 727
Website Mastodon

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

Stef, i implemented your version exactly like you did and it still doesn’t work. The all tags list shows, but when clicking on a single tag i get no results – just like before.

I got the version i am using from your website, it says 0.60.
When i go to your github, though, i can see, that for txp 4.6.2 only 0.51 would work?
Is that correct?
Because i am using 0.60 on txp 4.6.2 and maybe that’s the reason for all error.
Also i see the textpack link for 0.60 but am unsure how to install this?

Thanx much, again!


A hole turned upside down is a dome, when there’s also gravity.

Offline

#389 2018-02-27 10:59:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,485
Website GitHub

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

jayrope wrote #309459:

it still doesn’t work. The all tags list shows, but when clicking on a single tag i get no results – just like before.

Hmmm. Odd. You changed the section attribute in the <txp:smd_related_tags> to match your music section, right?

I got the version i am using from your website, it says 0.60.

Download and install it again. I naughtily replaced it last night with the patched master version from GitHub.

Although it says it’s 4.6.2 compatible, v0.51 still had the ‘position’ issue so you’re no better off. I think 0.60 should be fine for you, but please check it’s installed correctly by flicking your site to debugging mode and checking you don’t get any nasty errors or warnings from the plugin.

The updated version should also fix your gTxt() strings. But if not, grab that Textpack from GitHub, open it in a text editor, remove the “@#language” line at the top, then copy and paste the entire contents into the textarea at the bottom of the Admin->Languages panel and upload them. That should fix it.


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

#390 2018-02-27 14:30:47

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 727
Website Mastodon

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

Stef, i installed your updated version of 0.60 over my version ( EDIT: Vanished extension preferences page and options menu have come back when i switch the plugin ON… ai ai ai ai.)

But in the current state it still refuses to show individual tags with articles assigned.

On the good side the articles, which were tagged before still show their tags in the frontend. And the textpack is installed now, looks much better. I will double check now, that i have implemented your suggestions well, and suppose i get back here if i did.

(Sorry to bother you again…)

Last edited by jayrope (2018-02-27 14:56:16)


A hole turned upside down is a dome, when there’s also gravity.

Offline

Board footer

Powered by FluxBB