Поиск шаблона компонента в папке основного шаблона. Для упращения разработки нового шаблона совместно с компонентами
This commit is contained in:
parent
03cd371095
commit
95fc1b28c8
2 changed files with 18 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Коллекция
|
||||
*
|
||||
*
|
||||
*/
|
||||
class Collection implements ArrayAccess
|
||||
{
|
||||
|
|
@ -56,7 +56,7 @@ class Collection implements ArrayAccess
|
|||
return isset($this->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()
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue