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