From fdc13fd6be2b55e78e08def91226f882095f3a67 Mon Sep 17 00:00:00 2001 From: "origami11@yandex.ru" Date: Fri, 30 Sep 2022 16:21:42 +0300 Subject: [PATCH] =?UTF-8?q?fix=20=D0=9E=D0=BF=D1=80=D0=B5=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE?= =?UTF-8?q?=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Component.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Controller/Component.php b/src/Controller/Component.php index 3672a57..1f1e18e 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -98,7 +98,8 @@ class Controller_Component $selected = null; foreach ($this->viewPath as $index => $viewPath) { // Загружать шаблон по умолчанию если не найден текущий - if(is_dir(Path::join($this->viewPath[$index], 'templates', $template))) { + $dir = Path::join($this->viewPath[$index], 'templates', $template); + if(is_dir($dir)) { $tpl = new PHPTAL(Path::join($this->viewPath[$index], 'templates', $template, $name)); $tpl->setPhpCodeDestination(PHPTAL_PHP_CODE_DESTINATION); $selected = $index; @@ -107,10 +108,11 @@ class Controller_Component } if ($selected === null) { - $tpl = new PHPTAL(Path::join($this->viewPath[0], 'templates', 'modern', $name)); + // Последний вариант viewPath, путь к папке компонента + $selected = count($this->viewPath) - 1; + $tpl = new PHPTAL(Path::join($this->viewPath[$selected], 'templates', 'modern', $name)); $tpl->setPhpCodeDestination(PHPTAL_PHP_CODE_DESTINATION); $template = 'modern'; - $selected = 0; } $tpl->stripComments(true);