define('MODX_API_MODE', true);
require dirname(dirname(dirname(__FILE__))) . '/index.php';
$modx->getService('error','error.modError');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
/*ваш запрос к базе здесь*/
При добавлении новости указывали оригинальную дату публикации. Это 18, 19, 20, 21 и 22 годы
/**
* Gets the raw, unprocessed source content for a resource.
*
* @param array $options An array of options implementations can use to
* accept language, revision identifiers, or other information to alter the
* behavior of the method.
*
* return string The raw source content for the resource.
*/
$id = $modx->getOption('pageID',$scriptProperties, $modx->resource->get('id'));
$resource = $modx->getObject('modResource', $id);
$tvValue = $resource->getTVValue('yourTV'); // выбранное и сохраненное значение TV
$tv = $modx->getObject('site_tmplvars', $tvId); // tvId - ID вашего TV
$val = $tv->getValue($id);
$tvParts = explode("||", $val);
foreach($tvParts as $part){
$subParts = explode("==",$part);
if($subParts[1] ==$tvValue) return $subParts[0];
}
/* include the modX class */
if (!@include_once (MODX_CORE_PATH . "model/modx/modx.class.php")) {
$errorMessage = 'Site temporarily unavailable';
@include(MODX_CORE_PATH . 'error/unavailable.include.php');
header('HTTP/1.1 503 Service Unavailable');
echo "<html><title>Error 503: Site temporarily unavailable</title><body><h1>Error 503</h1><p>{$errorMessage}</p></body></html>";
exit();
}