Поиск шаблона компонента в папке основного шаблона. Для упращения разработки нового шаблона совместно с компонентами

This commit is contained in:
origami11@yandex.ru 2022-09-21 18:11:58 +03:00
parent 03cd371095
commit 95fc1b28c8
2 changed files with 18 additions and 6 deletions

View file

@ -244,9 +244,21 @@ class Controller_Component
$component->db = $db; $component->db = $db;
$component->registry = $registry; $component->registry = $registry;
$component->viewPath = array(COMPONENTS . '/' . $name . '/', BASE_PATH . '/components/' . $name . '/'); $template = $component->getTemplateName($registry);
$component->viewPath = array(
COMPONENTS . '/' . $name . '/',
BASE_PATH . '/components/' . $name . '/',
CMS_PATH . '/../templates/' . $template . '/_components/' . $name . '/',
BASE_PATH . '/templates/' . $template . '/_components/' . $name . '/'
);
if (defined('COMPONENTS_WEB')) { if (defined('COMPONENTS_WEB')) {
$component->webPath = array(COMPONENTS_WEB . '/' . $name, SITE_WWW_PATH . '/components/' . $name); $component->webPath = array(
COMPONENTS_WEB . '/' . $name,
SITE_WWW_PATH . '/components/' . $name,
TEMPLATE_WEB . '/' . $template . '/_components/' . $name,
SITE_WWW_PATH . '/templates/' . $template . '/_components/' . $name
);
$component->COMPONENTS_WEB = COMPONENTS_WEB; $component->COMPONENTS_WEB = COMPONENTS_WEB;
} else { } else {
$component->webPath = array('', SITE_WWW_PATH . '/components/' . $name, ''); $component->webPath = array('', SITE_WWW_PATH . '/components/' . $name, '');