Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#481 2020-06-03 15:00:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,479
Website GitHub

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

Okay, thanks for testing and glad it works with the forced title="0". But I’ll have to investigate why, in your case, the default value isn’t behaving.

Would you mind please furnishing me with your PHP version so I can see if perhaps it’s an obscure bug with empty() or something that’s triggering this and see if I can work around it. I can see you’re running Txp 4.8.1 so that’s all good. Thank you.


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

#482 2020-06-03 15:08:48

ThomasLeigh
Member
Registered: 2020-05-11
Posts: 24

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

Bloke wrote #323543:

Would you mind please furnishing me with your PHP version

Of course, from TextPattern admin panel: PHP version: 7.1.33.

Offline

#483 2020-07-30 11:30:16

santroy
New Member
Registered: 2020-07-30
Posts: 2

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

Is this plugin works with newest 4.8.2 version? I wanted to try it, so I installed it for first time, assigned some tags to articles and copypasted example from documenation that displays assigned tags. But when I click on given url’s it directs me to a 404 page.

Last edited by santroy (2020-07-30 11:31:15)

Offline

#484 2020-07-30 11:40:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,479
Website GitHub

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

As far as I can tell it’s working fine in 4.8.2. Things to check:

  • Are you using the latest release (there’s another version coming soon with some bug fixes but nothing major)?
  • Is the plugin load order set to 4 or lower on the Plugins panel?
  • Have you created a section that matches your ‘Trigger(s) for tag lists’ plugin pref so you can put your landing page tag handling code there?
  • Does your /section-for-tag-handling/ URL end with a trailing slash? Without that, Textpattern sometimes tries to interpret it as an article and 404s when it can’t find one.

Last edited by Bloke (2020-07-30 11:41:30)


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

#485 2020-07-30 11:58:22

santroy
New Member
Registered: 2020-07-30
Posts: 2

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

Bloke wrote #324996:

As far as I can tell it’s working fine in 4.8.2. Things to check:

  • Are you using the latest release (there’s another version coming soon with some bug fixes but nothing major)?
  • Is the plugin load order set to 4 or lower on the Plugins panel?
  • Have you created a section that matches your ‘Trigger(s) for tag lists’ plugin pref so you can put your landing page tag handling code there?
  • Does your /section-for-tag-handling/ URL end with a trailing slash? Without that, Textpattern sometimes tries to interpret it as an article and 404s when it can’t find one.

Yes, so I recreated those steps and I managed to fix my issues. Thank you!

Offline

#486 2021-02-26 20:26:12

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 517

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

I’ve got some problems with nesting:

On a multi-area website I have several sections with articles, which use tags.
In three sections I show subset-tag_lists A-Z which show if there are articles present regarding those tags or if those tags are only present in other sections – i which case the link leads to the summary tag results from all sections.

basically it is solved like this:
tag_list all sublevels of parent x > related tag of current section counted, if 0 related tags of all sections linked (/tags/tagname), if >0 link to this sections tags (/currentsection/tags/tagname)

Everything works well – save one:
If I am on a tag list page of a single tag, the above A-Z-tag list is not working – because only the current tag will be rendered by smd_related >0 all the other are rendered 0 thus /tags/tagname

I’d think that the smd_related_tags works in the context of the smd_tag_list as planned if there is no surrounding tag list context,
but it does switch to the general tag-list-context of the landing page and ignore the listing context of the actually surronding tag_list.
How can I get smd_related tags to ignore any landing pages context and only do what the surrounding smd_list says?

Last edited by saccade (2021-02-26 20:27:34)

Offline

#487 2021-02-26 20:31:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,479
Website GitHub

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

Have you tried using the type attribute of <smd::tag_list> to explicitly change the context from where it gets the info? Combined with the type attribute in <smd::related_tags> they might allow you to hunt and find info from different contexts rather than relying on the default (best guess).


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

#488 2021-02-26 20:50:53

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 517

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

I tried now, doesn’t work.
to be more clear:
I (1) provide a tag list – and (2) within that tag list I use smd_related_tags with a section-attribute to find out, if there are articles using that tag in this section, and then (3) use that information to generate different links to the tags:
section link if articles present, and general link if no articles are found in this section.

But if I am not on a general section, category or article page,
but instead on a tag page,
then smd_related_articles obviously doesn’t obey the directly surrounding tag_list,
but instead only provides the landing pages’ context tag – and so gives 0 for all other tags, which disturbes my different links.

You can view that here:

https://evebc.de gives a general A-Z list in the topmost navigation with one empty tag (Räume)
https://evebc.de/epiphanias gives a second section based list A-Z (third navigation line) with a differentiated tag list (which is as planned and very ok).
but
https://evebc.de/epiphanias/stichwort/gruppen-kreise gives an A-Z-list (third navigation line) with only “Gruppen & Kreise” filled and falsely showing the other tags as empty for that section (which is the problem I seek to solve, it should be the same as above).

NB:
dont bother the entry “Kita Sternengarten”, which is not exactly a tag, but a special section manually substituted for a tag.

PSS:
I already thought smd_tag_count would be a good replacement for my use of smd_related_tags, but I finally used that tag that way, because I cannot specialize smd_tag_count for counting only one sections tag result. But also I’m not sure if tag_count also would prefer the landings pages tag over the tag lists iterated tag if on a landing page.

Last edited by saccade (2021-02-26 21:01:06)

Offline

#489 2021-02-26 22:11:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,479
Website GitHub

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

Would you mind sharing your tag code please for your tag landing page so I can see how you’re using the tags and try to replicate this on my server. Plus please note any plugin settings you might be using that could affect the output (e.g. if you’re using categories or global tags etc). Then I might be able to figure out whether it’s something the plugin is doing incorrectly or if there’s a way round it. Thanks.


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

#490 2021-02-27 17:33:55

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 517

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

ok, I’ll try to share the code till tomorrow (it’s still a little messy and I have to cut out the working parts from some experimental surrounding)

this is on the the normal section’s page-template, which will be in effect if using tags in a section e.g. https://evebc.de/epiphanias/stichwort/taufe (‘stichwort’ = tag)
but it is the same in the common tag-landing page e.g. https://evebc.de/stichwort/taufe :

<txp:smd_if_tag_list> <main class="sixteen wide column"> <txp:smd_tag_list wraptag="" break="" > <txp:output_form form="stichwort_resultat" /> </txp:smd_tag_list> </main> <txp:else /> ... </txp:smd_if_tag_list>

ok, and here the dangerous part – this menu is placed outside the above code as a navigation menu:

first: call tag_list to prduce a list of all tags with parent “allgemein”:
<txp:smd_tag_list showall="1" parent="allgemein" wraptag="" break="" sublevel="0" sort="name asc" limit="99" >

second: prepare some variables with 0-result (explanation in the next step):
<txp:variable name="stichworttreffer" value='0' /><txp:variable name="stichwortlink" value="" /><txp:variable name="stichwortpopup" value='data-tooltip="Keine Treffer im Bereich, weiter zur Pfarrei" data-position="left center" data-inverted=""' /><txp:variable name="stichwortstatus" value="inactive " /><txp:variable name="stichwortsymbol" value='<i class="small angle double up icon"></i>' />

third: call smd_related_tags and change the variables by the results, most of them will be emptied by a result:
stichworttreffer if called from a section, the “count” only tag-results from that section (result fixed to 111 if >0)
stichwortlink also,if from a section prepare the later created link to reflect the section, if no results, the link will point to general tag landing stichwortstatus if nor results give the later created link the status “inactive”
stichwortsymbol also I want to diplay an arrow(angle) if empty, nothing if a result is present
stichwortpopup give a hint why this link is different
<txp:smd_related_tags type="article" section='<txp:if_section name="epiphanias,bethlehem,carolinen,kita-sternengarten"><txp:section /></txp:if_section>' wraptag="" break=""> <txp:variable name="stichwortlink" value='/<txp:section title="0" />' /><txp:variable name="stichwortstatus" value="" /><txp:variable name="stichwortsymbol" value="" /><txp:variable name="stichwortpopup" value="" /> <txp:variable name="stichworttreffer" value='111' /></txp:smd_related_tags>

fourth: if on the common tag-landing page all the variables have to be processed differently, because they all have no result (which is part of the reason of my question here) but here I can turn that generally for all – this is different from the section’s tag results, where I cannot do this for all:
<txp:if_section name="stichwort"><txp:variable name="stichwortlink" value="" /><txp:variable name="stichwortstatus" value="" /><txp:variable name="stichwortsymbol" value="" /><txp:variable name="stichwortpopup" value="" /></txp:if_section>

fourth: generate the link-list, first filter out the parent tag and change one special tag into a section link – for all the rest make links to the /section/stichwort/tagname or the /stichwort/tagname as processed above:
<txp:smd_if_tag name="allgemein"><txp:else /><txp:smd_if_tag name="kita-sternengarten"><a href='/<txp:smd_tag_name title="0" />' class="item"><txp:smd_tag_name title="1" /></a><txp:else /><a href='<txp:variable name="stichwortlink" />/stichwort/<txp:smd_tag_name title="0" />' class='<txp:variable name="stichwortstatus" />item' <txp:variable name="stichwortpopup" /> ><txp:smd_tag_name link="0" title="1" /><txp:variable name="stichwortsymbol" /></a></txp:smd_if_tag></txp:smd_if_tag>

close:
</txp:smd_tag_list>

Last edited by saccade (2021-02-27 20:47:58)

Offline

#491 2021-06-20 17:25:54

JimJoe
Member
From: United States
Registered: 2010-01-30
Posts: 507
Website

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

I’ll give this a try as a replacement for rss_unlimited_categories

Thanks Bloke

Offline

#492 2021-07-19 11:14:32

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 601
Website

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

Hi :)
Since the new Textpattern version includes the full jQuery UI with the autocomplete widget, then there is no need to include any additional plugins.
Therefore I modified your code by doing this and it seems to works fine:

1. Removed this code of the script and style tags:

            if ($quick > 0) {
                echo <<<EOJS
<script type="text/javascript" src="{$jsdir}{$jstail}jquery.autocomplete.pack.js"></script>
<link rel="stylesheet" type="text/css" href="{$csdir}{$cstail}jquery.autocomplete.css"></script>
EOJS;
            }

2. Replaced this:

                   jQuery("textarea[name='smd_tags_bytext']").autocomplete(smd_tagpool, {
                        multiple: true,
                        mustMatch: (($quick==2)?true:false),
                        autoFill: true
                    });

With this:
(taken from the widget example page: https://jqueryui.com/autocomplete/#multiple)

   function autocompleteSplit( val ) {
      return val.split( /,\s*/ );
    }
    function autocompleteExtractLast( term ) {
      return autocompleteSplit( term ).pop();
    }

    jQuery("textarea[name='smd_tags_bytext']")
      // don't navigate away from the field on tab when selecting an item
      .on( "keydown", function( event ) {
        if ( event.keyCode === jQuery.ui.keyCode.TAB &&
            jQuery( this ).autocomplete( "instance" ).menu.active ) {
          event.preventDefault();
        }
      })
      .autocomplete({
        minLength: 0,
        source: function( request, response ) {
          // delegate back to autocomplete, but extract the last term
          response( jQuery.ui.autocomplete.filter(
            smd_tagpool, autocompleteExtractLast( request.term ) ) );
        },
        focus: function() {
          // prevent value inserted on focus
          return false;
        },
        select: function( event, ui ) {
          var terms = autocompleteSplit( this.value );
          // remove the current input
          terms.pop();
          // add the selected item
          terms.push( ui.item.value );
          // add placeholder to get the comma-and-space at the end
          terms.push( "" );
          this.value = terms.join( ", " );
          return false;
        }
      });

Offline

Board footer

Powered by FluxBB