Last active
August 27, 2019 11:52
-
-
Save TrywaR/9ab48c685b55c09bfce1819e818bd477 to your computer and use it in GitHub Desktop.
MODX Revo | Tagger > 404 для страниц без результатов, убрать дубли
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Должно быть включено системное событие OnWebPageInit | |
// $modx->log(modX::LOG_LEVEL_ERROR, print_r($_GET,1)); | |
if (isset($_GET['teg'])){ | |
$return = false; | |
$arrTags = explode(',', $_GET['teg']); | |
if (count($arrTags) > 1){ | |
# Если больше 1 тега то возвращяем 404 | |
$return = true; | |
}else{ | |
# Если по такому тегу нет результатов, возвращаем 404 | |
$params = array( | |
'tags' => $_GET['teg'], | |
'where' => '{"isfolder": 0}' | |
); | |
$sSql = $modx->runSnippet('TaggerGetResourcesWhere', $params); | |
$params = array( | |
'parents' => '6', | |
'where' => $sSql, | |
'tpl' => '@INLINE ,', | |
); | |
$res = $modx->runSnippet('pdoResources', $params); | |
if ($res === '') | |
$return = true; | |
} | |
if ($return) | |
$modx->sendErrorPage(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment