Errors and exceptions handling, #16
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@121 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
@ -17,9 +17,12 @@ class PHPView implements iView
|
||||
protected $extension = '.phtml';
|
||||
protected $template = '';
|
||||
|
||||
public function __construct($path)
|
||||
public function __construct($config)
|
||||
{
|
||||
$this->setPath($path);
|
||||
if (!isset($config['path'])) {
|
||||
throw new Exception('Configuration must have a "host".');
|
||||
}
|
||||
$this->setPath($config['path']);
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
@ -53,10 +56,11 @@ class PHPView implements iView
|
||||
unset($template);
|
||||
extract($this->variables);
|
||||
ob_start();
|
||||
if (!(include($this->template)) == 'OK') {
|
||||
if (!is_readable($this->template)) {
|
||||
ob_clean();
|
||||
throw new Exception('Template "' . $this->template .'" not found.');
|
||||
}
|
||||
include($this->template);
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user