Good morning,
I’m working with getPage/getResources to retrieve pages identified by a comma-separated list of resource ids from an auto tag. The challenge I’m facing is with the &tvFilters, where the commas in my list are being interpreted as AND conditional operators rather than mere delimiters.
Here’s my getPage code:
[[!getPage?
&element=`getResources`
&where=`{"template:=":28}`
&parents=`715`
&tpl=`tpl-example`
&tvPrefix=`tv.`
&includeTVs=`10,89,90,92,93,100,101,129`
&processTVs=`10,89,90,92,93,100,101,129`
&limit=`0`
&sortbyTV=`gen-Date`
&sortbyTVType=`datetime`
&sortdirTV=`DESC`
&tvFilters=`autotagTV==[[*id]]||autotagTV==[[*id]],%||autotagTV==%,[[*id]]||autotagTV==%,[[*id]],%`
]]
Here’s a breakdown of &tvFilters, so it is easier on the eyes:
- autotagTV = [[*id]] - exact match
- autotagTV = [[*id]],% -array begins with targeted id
- autotagTV = %,[[*id]] -array ends with targeted id
- autotagTV = %,[[*id]],% -targeted id is in the middle of the array
The auto tag has a input type of “Listbox (Multi-Select)” with the dropdown options of:
@SELECT `pagetitle`,`id` FROM `[[+PREFIX]]site_content` WHERE `deleted`=0 AND `template`=23 ORDER BY menutitle
I’ve tried using escape characters like forward slash, backslash, and the HTML encoding for comma ,, but none of these have worked.
Would anyone know of an escape character that I could use so that &tvFilters will interpret the comma as a character rather than the AND operator? I’m aware that changing the delimiter in the auto tag TV is an option, but it would be time-consuming to patch it at other places, and I’d prefer to avoid it if there’s a simpler solution available.
Thanks for your time,
Chris