Example #1
0
 public function includeTemplate($path, $params = array(), $elements = array(), $theme = null)
 {
     // Include template with parameter options and return parsed output
     $view = new View($this->controller, $this->model, $this);
     $view->setTemplate($path, $theme);
     $view->assignVars($this->vars);
     $view->assignParams($params);
     $view->setElements($elements);
     return $view->createOutput();
 }
Example #2
0
<?php

include_once __DIR__ . "/classes/includes.php";
session_start();
try {
    // Try creating output from request
    $controller = new Controller($_REQUEST['url']);
    $model = new Model($controller);
    $view = new View($controller, $model);
    $view->assignVar("controller", $controller);
    echo $view->createOutput();
} catch (Exception $e) {
    // Catch possible exceptions
    $exception = new View();
    $exception->setTemplate("error/exception");
    $exception->assignVar("e", $e);
    echo $exception->createOutput();
}
 public static function createInput($type, $name, $value, array $options = array())
 {
     // Print single input directly instead of gathering them in the instance first
     $params = array_merge($options, array("type" => $type, "name" => $name, "value" => self::escape($value)));
     $input = new View();
     $input->setTemplate("element/form/input/" . $type);
     $input->assignParams($params);
     return $input->createOutput();
 }