Memcache, refactoring, View helpers, #16
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@124 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
@ -9,11 +9,15 @@
|
||||
* @filesource $URL$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @method ViewHelperGet get()
|
||||
*/
|
||||
class PHPView implements iView
|
||||
{
|
||||
|
||||
protected $path = '';
|
||||
protected $variables = array();
|
||||
protected $helpers = array();
|
||||
protected $extension = '.phtml';
|
||||
protected $template = '';
|
||||
|
||||
@ -69,6 +73,31 @@ class PHPView implements iView
|
||||
return htmlentities($var, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helpers call
|
||||
*
|
||||
* @param mixed $name
|
||||
* @param mixed $args
|
||||
* @return ViewHelper
|
||||
*/
|
||||
public function __call($name, $args)
|
||||
{
|
||||
$helper = $this->getHelper($name);
|
||||
return call_user_func_array(array($helper, $name), $args);
|
||||
}
|
||||
|
||||
protected function getHelper($name)
|
||||
{
|
||||
if (!isset($this->helpers[$name])) {
|
||||
$class = 'ViewHelper' . ucfirst($name);
|
||||
if (!class_exists($class)) {
|
||||
throw new GeneralException('View helper "' . $class . '" not found.');
|
||||
}
|
||||
$this->helpers[$name] = new $class($this);
|
||||
}
|
||||
return $this->helpers[$name];
|
||||
}
|
||||
|
||||
protected function getTemplatePath($template)
|
||||
{
|
||||
return $this->path . $template . $this->extension;
|
||||
|
Reference in New Issue
Block a user