Example #1
0
    /**
     * Подключение файла с компонентом в рамках текущего шаблона
     * @param Rzn\Library\Component\IncludeWithTemplate $includeWithTemplate
     */
    /** @var Rzn\Library\Component\IncludeWithTemplate  $includeWithTemplate */
    $includeWithTemplate = $sm->get('IncludeComponentWithTemplate');
    $includeWithTemplate->setFreeInclude();
    $includeWithTemplate->includeComponent($params['component']);
    // имеет метод __invoke
    if (!$includeWithTemplate->isSuccess()) {
        throw new Exception('Компонент с таким кодовым именем не зарегистрирован.');
    }
    $eventManager->trigger('direct.include.component.success', null, $params);
    /*
        $path = $_SERVER['DOCUMENT_ROOT'] . '/local/templates/' . SITE_TEMPLATE_ID . '/include/component/' . $_REQUEST['component'] . '.php';
    
        if (!is_file($path)) {
            throw new Exception('Компонент с таким кодовым именем не зарегистрирован.');
        }
    
        include($path);
    */
} catch (Exception $e) {
    //echo SITE_TEMPLATE_ID;
    $APP = Registry::getApplication();
    CHTTP::SetStatus("404 Not Found");
    @define("ERROR_404", "Y");
    $APP->SetTitle("Страница не найдена");
    include __DIR__ . '/templates/' . SITE_TEMPLATE_ID . '/404.php';
}
//require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");