Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,639
Website

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.

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: 651
Website

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: 9,639
Website

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.

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: 651
Website

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: 9,639
Website

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.

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: 651
Website

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: 9,639
Website

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.

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: 651
Website

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: 9,639
Website

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.

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: 651
Website

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