From 95fc1b28c8a0ea60cf3c8aadc77d61feec985757 Mon Sep 17 00:00:00 2001 From: "origami11@yandex.ru" Date: Wed, 21 Sep 2022 18:11:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B8=D1=81=D0=BA=20=D1=88=D0=B0?= =?UTF-8?q?=D0=B1=D0=BB=D0=BE=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D1=82=D0=B0=20=D0=B2=20=D0=BF=D0=B0=D0=BF?= =?UTF-8?q?=D0=BA=D0=B5=20=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D0=B0.=20=D0=94?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=83=D0=BF=D1=80=D0=B0=D1=89=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=80=D0=B0=D0=B7=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=BE=D0=B2=D0=BE=D0=B3=D0=BE=20=D1=88=D0=B0?= =?UTF-8?q?=D0=B1=D0=BB=D0=BE=D0=BD=D0=B0=20=D1=81=D0=BE=D0=B2=D0=BC=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=BD=D0=BE=20=D1=81=20=D0=BA=D0=BE=D0=BC=D0=BF?= =?UTF-8?q?=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Collection.php | 6 +++--- src/Controller/Component.php | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Collection.php b/src/Collection.php index 1370be3..8a4ba7d 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -1,7 +1,7 @@ data[$key]) && $this->data[$key] != '' ? $this->data[$key] : $default; } - public function getInt($key, $default = 0) + public function getInt($key, $default = 0) { return (int)$this->get($key, $default); } @@ -69,7 +69,7 @@ class Collection implements ArrayAccess public function getNat($key, $default = 1) { $result = (int)$this->get($key, $default); - return (($result > 0) ? $result : $default); + return (($result > 0) ? $result : $default); } public function clear() diff --git a/src/Controller/Component.php b/src/Controller/Component.php index 97315f4..bb8938f 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -244,14 +244,26 @@ class Controller_Component $component->db = $db; $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')) { - $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; } else { $component->webPath = array('', SITE_WWW_PATH . '/components/' . $name, ''); } - } + } $stmt = $db->prepareStatement("SELECT * FROM component WHERE code = ?"); $stmt->setString(1, $expression);