|
|
@ -24,7 +24,7 @@ class PHPView implements iView |
|
|
|
public function __construct($config) |
|
|
|
{ |
|
|
|
if (!isset($config['path'])) { |
|
|
|
throw new Exception('Configuration must have a "path".'); |
|
|
|
throw new Exception('Configuration must have a "path" set.'); |
|
|
|
} |
|
|
|
$this->setPath($config['path']); |
|
|
|
} |
|
|
@ -49,11 +49,41 @@ class PHPView implements iView |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $name |
|
|
|
* @param mixed $value |
|
|
|
*/ |
|
|
|
public function assign($name, $value = null) |
|
|
|
{ |
|
|
|
$this->variables[$name] = $value; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $name |
|
|
|
* @param mixed $value |
|
|
|
*/ |
|
|
|
public function prepend($name, $value) |
|
|
|
{ |
|
|
|
if (isset($this->variables[$name])) { |
|
|
|
$this->variables[$name] = $value . $this->variables[$name]; |
|
|
|
} else { |
|
|
|
$this->variables[$name] = $value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $name |
|
|
|
* @param mixed $value |
|
|
|
*/ |
|
|
|
public function append($name, $value) |
|
|
|
{ |
|
|
|
if (isset($this->variables[$name])) { |
|
|
|
$this->variables[$name] .= $value; |
|
|
|
} else { |
|
|
|
$this->variables[$name] = $value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function fetch($template) |
|
|
|
{ |
|
|
|
$this->template = $this->getTemplatePath($template); |
|
|
|