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);