Source for file TemplateView.php
Documentation is available at TemplateView.php
* "THE BEER-WARE LICENSE" (Revision 42):
* "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
* @copyright Copyright (c) 2007 Sven Strittmatter
* Enter description here...
* @todo complete description
* @copyright Copyright (c) 2007 Sven Strittmatter
* @author "Sven Strittmatter" <ausserirdisch@sven-space.de>
* @link http://www.sven-space.de/code/php/MVClasses
$this->_template = $template;
$this->_helpers = array();
public function assign($name, $value) {
$this->_vars[$name] = $value;
public function render(Request $req, Response $res) {
include_once $this->_template;
public function __get($name) {
if (isset ($this->_vars[$name])) {
return $this->_vars[$name];
public function __call($name, $args) {
throw new Exception("Unknown view helper: $name");
return $helper->execute($args);
if (!isset ($this->_helpers[$helper])) {
$class = $name. "ViewHelper";
$file = dirname($this->_template). "/ViewHelpers/{$class}.php";
$this->_helpers[$helper] = new $class();
return $this->_helpers[$helper];
|