How do I get a list of resources that match a Tagger tag in the current resource?

I can’t seem to think through the proper syntax for this. I have installed Tagger and some of my resources are part of a series. So in Tagger I have a group(3) called “Series” with each series name. (Some are not part of a series and would be blank.)

On an existing resource I want to show a list of more in the same series. How do I get and display a list of resources that match the series tag from the current resource?

Do I need to be using the TaggerGetResourcesWhere snippet with TaggerGetTags being called inside that or is there a more streamlined way of getting the matching resources?

My plain snippet call with pdoResources looks like this and lists the first twenty unfiltered items as expected.

[[!pdoResources?
    &parents=`83`
    &hideContainers=`1`
    &sortby=`createdon`
    &sortdir=`ASC`
    &limit=`20`
    &tplWrapper=`series-outer-tpl`
    &tpl=`series-row-tpl`
]]

If I add the following &where line nothing changes. It still lists the first twenty.

&where=`[[!TaggerGetResourcesWhere? &groups=`3` &tags=`[[!TaggerGetTags? &resources=`[[*id]]` &rowTpl=`tag-alias-tpl`]]` ]]

If I use this &where, then nothing gets output at all.

&where=`[[!TaggerGetResourcesWhere? &groups=`3` &tags=`[[+id]]` ]]`

There is a snippet in Tagger called TaggerGetRelatedWhere. I think this snippet does what you want.
(Look at the comments in the snippet above the code, to see how to use it.)

1 Like

Thanks. That worked well.

How does one update the official MODx Documentation to make mention of the extra snippets?

https://docs.modx.com/current/en/contribute/documentation

1 Like