Footniko
Новичок
Приветствую.
Не удается подключить файл через метод класса. Сам файл подключается, но его переменные не доступны.
Rating.php
Не удается подключить файл через метод класса. Сам файл подключается, но его переменные не доступны.
PHP:
public function getComponent($component)
{
$this->_component = $this->sitePath() . 'components/' . ucfirst($component) . '/index.php';
require_once($this->_component);
}
public function show()
{
//require_once($this->sitePath() . 'components/Rating/index.php'); // так будет работать
//$Rating = new Component_Rating;
$this->getComponent('Rating');
$Rating->test(); // так не работает
}
PHP:
class Component_Rating
{
public function test()
{
echo "It's a test!";
}
}