Closed u007 closed 12 years ago
Bump the topic. But I have some notes:
While the current getResources version only has the "==" operator, I recommend that this snippet should also has others, like:
$validOperators = array(
"NULL safe equal" => '<=>'
, "equal" => '='
, "greater equal" => '>='
, "greater" => '>'
, "left shift" => '<<'
, "less equal" => '<='
, "left shift" => '<<'
, "less" => '<'
, "not equal" => '!='
, "right shift" => '>>'
);
filter2==one||filter1==bar%||filter1==foo
How about to change it as the Ditto's way, or like:
&tvFilters=filter2, less, 50 AND filter2, less, '15000' OR filter1, equal, %foo% OR filter3,equal,'ANDROMEDA' OR name, equal, 'BORG'
I'd prefer to use some json style then, although that may only be nice from a dev point of view and will discourage others due to its initial complexity..
Though I am rejecting the specific code and some of the suggestions here, I am adding support for new operators in the 1.4.2-pl release coming soon.
I've done some modification to getResources to accomodate more TVFilters condition operators such as : != EXISTS NOTEXISTS | : for OR operator
And changed that the "OR" "|" condition will only effect after the main condition is meet, etc. published='1' and deleted='0'
Examples: tvFilters= mytv!=%xxx%|mytv==NOTEXISTS Setting condition to TV mytv does not contain tag "xxx" or no mytv variable exists
getResources2.php http://www.mercstudio.net/assets/media/getResources2.php.zip