Hi all. I am trying to use output filters with 2 TV elements, here is the filter I'd like to see working:
[[*myTVOne:is=``:and:myTVTwo:is=``:then=`Nothing Here!`:Else=`Something Here!`]]
Basically, if both TVs are empty show one thing, but if either has content show another thing. Is that possible?
---
And again, I tried searching the broken search on this forum first but even "Output Filter" returned zero results... thanks for your help.
-
☆ A M B ☆
- 24,524 Posts
No, the output modifiers only work on a single input. You'll need a snippet to handle that situation.
Bummer and thank you.
Snippet writing is not my cup of tea.
-
☆ A M B ☆
- 24,524 Posts
This should work (untested)
$tvOne = $modx->resource->getTVValue('myTVOne');
$tvTwo = $modx->resource->getTVValue('myTVTwo');
if(($tvOne == '') && ($tvTwo == '')) {
return "Nothing Here";
} else {
return "Something Here";
}
you could also try to put them into a chunk
and check that chunk with
[[$myTVOne_myTVTwo:is=``:then=`Nothing Here!`:else=`Something Here!`]]