&where=`[{
"field1":"[[!GETsel1]]",
"field2":"[[!GETsel2]]"
}]` if ( isset($_GET['sel1']) ) {
return $_GET['sel1'];
} else {
return "";
};
This question has been answered by Bruno17. See the first response.
$sel1 = $modx->getOption('sel1',$_GET,'');
$sel2 = $modx->getOption('sel2',$_GET,'');
$where = array();
$output = '';
if (!empty($sel1)){
$where['field1'] = $sel1;
}
if (!empty($sel2)){
$where['field2'] = $sel2;
}
if (count($where)>0){
$output = '&where=`' . $modx->toJson($where) . '`';
}
return $output;&where=`[{
"field1":"[[!GETsel1]]",
"field2":"[[!GETsel2]]"
}]`[[!prepareWhere]]