Для добавления нового движка шаблонизации на сайт в файл /bitrix/php_interface/init.php необходимо добавить следующее:
1. Глобальную переменную $arCustomTemplateEngines, которая содержит ассоциативный массив, каждый элемент которого имеет вид:
"код_шаблонизатора" => array(
"templateExt" => array("расширение1"[, "расширение2"...]),
"function" => "имя_функции_подключения_движка"
)
где:
"код_шаблонизатора" - произвольное уникальное в рамках сайта слово;
"расширениеN" - расширение файла, который должен обрабатываться этим движком шаблонизации;
"имя_функции_подключения_движка" - имя функции, которая будет вызываться, если шаблон компонента имеет указанное расширение.
2. Функцию подключения движков:
function имя_функции_подключения_движка($templateFile, $arResult, $arParams, $arLangMessages, $templateFolder, $parentTemplateFolder, $template),
где:
$templateFile – путь к файлу шаблона относительно корня сайта,
$arResult – массив результатов работы компонента,
$arParams – массив входных параметров компонента,
$arLangMessages – массив языковых сообщений (переводов) шаблона,
$templateFolder – путь к папке шаблона относительно корня сайта (если шаблон лежит не в
папке, то эта переменная пуста),
$parentTemplateFolder - путь относительно корня сайта к папке шаблона комплексного
компонента, в составе которого подключается данный компонент (если компонент
подключается самостоятельно, то эта переменная пуста),
$template – объект шаблона.
Рассмотрим подключение движков на конкретных примерах.
Страница
1 - 1 из 3
Начало | Пред. |
1
2
3
|
След. |
Конец
[Bitrix\Main\ObjectNotFoundException] Forum is not found. (510) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/forum/lib/forum.php:305 #0: Bitrix\Forum\Forum->__construct(integer) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/forum/lib/internals/entityfabric.php:20 #1: Bitrix\Forum\Forum::getById(integer) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/forum/classes/general/forum_new.php:559 #2: CAllForumNew::GetUserPermission(integer, array) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/forum/include.php:141 #3: ForumCurrUserPermissions(integer) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/components/bitrix/forum.topic.reviews/component.php:177 #4: include(string) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/classes/general/component.php:605 #5: CBitrixComponent->__includeComponent() /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/classes/general/component.php:680 #6: CBitrixComponent->includeComponent(string, array, object, boolean) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/classes/general/main.php:1039 #7: CAllMain->IncludeComponent(string, string, array, object) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/components/bitrix/news/templates/.default/detail.php:150 #8: include(string) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/classes/general/component_template.php:789 #9: CBitrixComponentTemplate->__IncludePHPTemplate(array, array, string) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/classes/general/component_template.php:884 #10: CBitrixComponentTemplate->IncludeTemplate(array) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/classes/general/component.php:764 #11: CBitrixComponent->showComponentTemplate() /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/classes/general/component.php:712 #12: CBitrixComponent->includeComponentTemplate(string) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/components/bitrix/news/component.php:216 #13: include(string) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/classes/general/component.php:605 #14: CBitrixComponent->__includeComponent() /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/classes/general/component.php:680 #15: CBitrixComponent->includeComponent(string, array, boolean, boolean) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/classes/general/main.php:1039 #16: CAllMain->IncludeComponent(string, string, array, boolean) /home/host1328954/k-78.ru/htdocs/suvenir/content/articles/index.php:113 #17: include_once(string) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/modules/main/include/urlrewrite.php:159 #18: include_once(string) /home/host1328954/k-78.ru/htdocs/suvenir/bitrix/urlrewrite.php:2