В СMS2 нет этих глобальных переменных
This commit is contained in:
parent
538239a6c4
commit
a83f70422c
3 changed files with 27 additions and 9 deletions
|
|
@ -263,10 +263,16 @@ class Controller_Component
|
||||||
$component->parameter = $params;
|
$component->parameter = $params;
|
||||||
$component->template = $params->get('template', false);
|
$component->template = $params->get('template', false);
|
||||||
|
|
||||||
global $componentsConfig;
|
|
||||||
$editor = $component->getEditUrl();
|
$editor = $component->getEditUrl();
|
||||||
if ($editor) {
|
if ($editor) {
|
||||||
$componentsConfig[] = $editor;
|
if(class_exists("Controller_Site")){ //Если мы в CMS2
|
||||||
|
$instance = Controller_Site::getInstance();
|
||||||
|
$instance->componentsConfig[] = $editor;
|
||||||
|
}else{
|
||||||
|
global $componentsConfig;
|
||||||
|
$componentsConfig[] = $editor;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $component;
|
return $component;
|
||||||
|
|
@ -311,6 +317,10 @@ class Controller_Component
|
||||||
return '?' . http_build_query($arr);
|
return '?' . http_build_query($arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated В CMS2 перенесено в контроллер сайта!
|
||||||
|
*/
|
||||||
|
|
||||||
function addRequireJsPath($name, $path, $shim = null) {
|
function addRequireJsPath($name, $path, $shim = null) {
|
||||||
global $requireJsConfig;
|
global $requireJsConfig;
|
||||||
$requireJsConfig['paths'][$name] = $path;
|
$requireJsConfig['paths'][$name] = $path;
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,14 @@ class View_Page extends View_View
|
||||||
{
|
{
|
||||||
//$result = phptal_component($match, $offset);
|
//$result = phptal_component($match, $offset);
|
||||||
|
|
||||||
//*
|
|
||||||
global $db, $registry; // Нужно как-то передавать параметры
|
if(class_exists("Controller_Site")){ //Если мы в CMS2
|
||||||
|
$component = Controller_Site::loadComponent($match);
|
||||||
$component = Controller_Component::loadComponent($match, $db, $registry);
|
}else{
|
||||||
|
global $db, $registry; //
|
||||||
|
$component = Controller_Component::loadComponent($match, $db, $registry);
|
||||||
|
}
|
||||||
|
|
||||||
$req = new HttpRequest();
|
$req = new HttpRequest();
|
||||||
unset($req['active_page']);
|
unset($req['active_page']);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,14 @@ function phptal_time ($e)
|
||||||
* Функция подключения компонента
|
* Функция подключения компонента
|
||||||
*/
|
*/
|
||||||
function phptal_component ($expression) {
|
function phptal_component ($expression) {
|
||||||
global $db, $registry; // Нужно как-то передавать параметры
|
|
||||||
|
|
||||||
$begin = microtime(true);
|
$begin = microtime(true);
|
||||||
$component = Controller_Component::loadComponent($expression, $db, $registry);
|
|
||||||
|
if(class_exists("Controller_Site")){ //Если мы в CMS2
|
||||||
|
$component = Controller_Site::loadComponent($match);
|
||||||
|
}else{
|
||||||
|
global $db, $registry; // Иначе обращаемся к глобальным переменным
|
||||||
|
$component = Controller_Component::loadComponent($expression, $db, $registry);
|
||||||
|
}
|
||||||
$req = new HttpRequest();
|
$req = new HttpRequest();
|
||||||
|
|
||||||
$result = $component->execute($req);
|
$result = $component->execute($req);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue