В СMS2 нет этих глобальных переменных
This commit is contained in:
parent
538239a6c4
commit
a83f70422c
3 changed files with 27 additions and 9 deletions
|
|
@ -45,10 +45,14 @@ function phptal_time ($e)
|
|||
* Функция подключения компонента
|
||||
*/
|
||||
function phptal_component ($expression) {
|
||||
global $db, $registry; // Нужно как-то передавать параметры
|
||||
|
||||
$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();
|
||||
|
||||
$result = $component->execute($req);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue