symlink
symlink

Reputation: 12218

How to display resources in modx with a specific TV

I'm trying to use getResources to only show the resources with a certain type of template variable. I know I'm doing something wrong b/c the page is displaying all template vars:

[[!getResources? 
&parent=`[[*id]]` 
&showHidden=`1` 
&limit=`0` 
&tpl=`Dining Section` 
&includeContent=`1` 
&includeTVs=`1` 
&processTVs=`1` 
&tvPrefix=`` 
&tvFilters=`Dining Section Title != ''`]]

In the last argument I am trying to only display resources with the TV "Dining Section Title". Any help would be appreciated.

Upvotes: 0

Views: 976

Answers (2)

symlink
symlink

Reputation: 12218

I solved it. I needed to remove the single quotes from the tvFilters value.

[[!getResources? 
  &parent=`[[*id]]` 
  &showHidden=`1` 
  &limit=`0` 
  &tpl=`Dining Section` 
  &includeContent=`1` 
  &includeTVs=`1` 
  &processTVs=`1` 
  &tvPrefix=`` 
  &tvFilters=`Dining Section Title!=`
]]

Thanks okyanet for the help.

Upvotes: 0

okyanet
okyanet

Reputation: 3146

Your syntax is missing the backticks around the option values and you cannot have spaces in Chunk or TV names. Check what the actual TV and Chunk names are, then reformat your snippet call like this:

[[!getResources? 
   &parent=`[[*id]]` 
   &showHidden=`1` 
   &limit=`0` 
   &tpl=`DiningSection` 
   &includeContent=`1` 
   &includeTVs=`1` 
   &processTVs=`1` 
   &tvPrefix=`` 
   &tvFilters=`DiningSectionTitle!=''`
   ]]

Upvotes: 1

Related Questions