On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Quote from: jrotering at Apr 22, 2013, 03:14 PM

    The only problem is, I can't figure out how to stop it from showing up in the URL. 'tags' is the default value of 'tagKey' property in toLinks - so that's where it is coming from. But there doesn't seem to be a way to tell toLinks to NOT send that bit of the query string. The closest I've been able to come up with is
    [[!toLinks? &items=`[[+tv.edp_resourcetags]]` &tagKey=`` &target=`4347`]]

    ...which sends it with an empty value:
    ?tag=grumble&key=


    This works - my results page is showing results. But it feels like a frustrating hack. I want to understand what my code isn't doing that it should be, or what that value is supposed to be doing, or... something. Can anyone shed a light on this?

    You have to use the same TVs name in 3 places to make it working, example:

    [[!toLinks? &items=`[[+tv.your-tag-name]]` &tagKey=`your-tag-name` &target=`123`]]


    and:

    [[!getResourcesTag? &tagKey=`your-tag-name` &elementClass=`modSnippet` &element=`getResources` &parents=`321` &limit=`0` &tpl=`myTpl` ...]]


    and that's it!
    • DavidJColbran Reply #12, 8 years ago
      i could only get this working using the hack - putting the TV in the three places as above didn't seem to work, so i've gone with setting this &tagKey=`` in the call and yep it works
      • I have this working. However, when I set the tolinks snippet to use friendly URLs as follows:
        [[!tolinks? &tagKey=`article_tags` &items=`[[+tv.article_tags]]` &outputDelim=` / ` &useTagsFurl=`1` &target=`5`]]

        I get redirected to my default 404 page I designated in system settings. I have already tried using a custom tolinks template:
        <a class="[[+cls]]" href="[[~[[+target]]]]/[[+tagKey]]/[[+tag:urlencode]]">[[+item]]</a>

        Any pointers at what is causing this?
        • Is it possible to filter with getResourcesTag for multiple tags?