The fact that getting a set of documents limited by a number of OR clauses is so hard to implement within MODx annoyed me in a highest degree. It should also be admitted that Bruno’s idea with two inner Ditto calls is perfect -- its logic is beyond reproach. I didn’t play with it in practice so I cannot tell why it does not work.
However, I designed simple and easy-to-imagine idea how to get documents by many conditions joined with logical OR. (Ditto’s filter throws out documents so multiple clauses in filter parameter always produce logical AND within final set that we are left with.) My idea is based on PHx -- luckily, Ditto supports it by default. Suppose that we need to get documents whose pagetitle contains word "MODx" OR menslist TV contains text "something else".
Ditto call:
[[Ditto? &parents=`...` &depth=`...` &display=`all` &tpl=`get-by-or-clause`]]
Chunk "get-by-or-clause":
[+phx:if=`[+pagetitle:contains=`MODx`+][+menslist:contains=`something else`+]`:is=`00`:then=``:else=`{{your-chunk-to-display-doc}}`+]
We need custom PHx modifier "contains" here, but it is funny simple to implement, and, what is more important, once implemented it may be used on many occasions. New modifier should be implemented as a snippet named "phx:contains":
<?php
return strpos($output, $options) === FALSE ? '0' : '1';
?>
How it works? "contains" modifier transforms placeholder into ’1’ or ’0’ depending on whether it contains requested text or not. "if" statement concatenates both transformed placeholders pagetitle and menslist -- if it appears to be "00" (neither pagetitle contains "MODx" nor menslist contains "something else") no output is produced, otherwise (at least one condition is satisfied) regular output is rendered. The idea was tested on live site.
Happy New Year for all members of this forum!