Пример #1
0
<?php

require_once dirname(__DIR__) . '/../../autoload.php';
ini_set('display_errors', true);
session_start();
$view = new PEAR2\Pyrus\Developer\CoverageAnalyzer\Web\View();
$rooturl = parse_url($_SERVER['REQUEST_URI']);
$rooturl = $rooturl['path'];
$controller = new PEAR2\Pyrus\Developer\CoverageAnalyzer\Web\Controller($_GET);
$controller::$rooturl = $rooturl;
$savant = new PEAR2\Templates\Savant\Main();
$savant->setClassToTemplateMapper(new PEAR2\Pyrus\Developer\CoverageAnalyzer\Web\ClassToTemplateMapper());
$savant->setTemplatePath(__DIR__ . '/templates');
$savant->setEscape('htmlentities');
echo $savant->render($controller);
Пример #2
0
            $this->view = $options['view'];
        }
        $this->output = new $this->view_map[$this->view]();
    }
}
class BaseballPlayer
{
    public $name = 'Joseph Baseball <AKA: Joey B>';
    public $years_on_team = array(2005, 2008);
    function __construct()
    {
        $this->years_on_team[] = new PartialSeason(date('Y'));
    }
}
class PartialSeason
{
    public $start;
    public $end;
    function __construct($start, $end = null)
    {
        $this->start = $start;
        if ($end) {
            $this->end = $end;
        }
    }
}
$team = new BaseballTeam();
$team->name = 'Phillies';
$savant = new PEAR2\Templates\Savant\Main();
$savant->setEscape('htmlspecialchars');
echo $savant->render($team);