$_GET['date'] = '2018'; // жестко прописываю нужный параметр для фильтра
$filter = array();
if($_GET['date']) {
$filter[] = ['date' => $_GET['date']];
}
if($filter) {
$where = $modx->toJSON($filter);
}
$params = array(
'docid' => 198,
'tvname' => 'field-news',
//'where' => $where
);
return $modx->runSnippet('getImageList', $params);
Array
(
[MIGX_id] => 1
[desc] => первая нвость
[date] => 2018
[_alt] => 0
[_first] => 1
[_last] =>
[idx] => 1
[property.docid] => 198
[property.tvname] => field-news
)
Array
(
[MIGX_id] => 2
[desc] => вторая новсть
[date] => 2017
[_alt] => 1
[_first] =>
[_last] =>
[idx] => 2
[property.docid] => 198
[property.tvname] => field-news
)
Array
(
[MIGX_id] => 3
[desc] => третья новость
[date] => 2017
[_alt] => 0
[_first] =>
[_last] => 1
[idx] => 3
[property.docid] => 198
[property.tvname] => field-news
)
/*$domains = array (
'pages1.site.ru' => 190,
'pages2.site.ru' => 161,
);*/
$domains = [];
if(!$docs = $modx->getCollection('modResource', array(
'parent' => 15,
'published' => 1,
'deleted' => 0,
'searchable' => 1
))){return;}
foreach ($docs as $doc) {
$domains[$doc->get('alias').'site.ru'] = $doc->get('id');
}
//переключение url на поддомен
switch ($modx->event->name) {
case 'OnHandleRequest':
if (array_key_exists($_SERVER['HTTP_HOST'], $domains)) {
$modx->config['site_start'] = $domains[$_SERVER['HTTP_HOST']];
}
break;
case 'OnPageNotFound':
if (array_key_exists($_SERVER['HTTP_HOST'], $domains)) {
$subdomain = array_shift(explode('.', $_SERVER['HTTP_HOST']));
if ($id = $modx->findResource($subdomain.$_SERVER['REQUEST_URI'] , 'web')) {
$modx->sendForward($id);
}
}
break;
}