Exemple #1
0
 function render($template, $context = array())
 {
     if (!isset($this->_template)) {
         $this->_template = Minim_Template::getInstance();
     }
     return $this->_template->render($template, $context);
 }
Exemple #2
0
 function __construct()
 {
     $this->_stack = array();
     $this->_vars = array();
     $this->_template = Minim_Template::getInstance();
     $this->_template->addFunction('exec', '$cmd', '
         $pc = Comity_Test::getInstance("Test");
         $pc->startExec($cmd);
     ');
     $this->_template->addFunction('endExec', '', '
         $pc = Comity_Test::getInstance("Test");
         $pc->endExec();
     ');
     $this->_template->addFunction('assertEquals', '$expr', '
         $pc = Comity_Test::getInstance("Test");
         $pc->assertEquals($expr);
     ');
     $this->_template->addFunction('endAssert', '', '
         $pc = Comity_Test::getInstance("Test");
         $pc->endAssert();
     ');
 }
Exemple #3
0
<?php

$start = microtime(TRUE);
error_reporting(E_ALL | E_STRICT);
require_once 'Minim/Autoloader.php';
$loader = new Minim_Autoloader();
spl_autoload_register(array($loader, 'loadClass'));
$GLOBALS['database'] = array('dsn' => "sqlite:" . realpath(dirname(__FILE__) . "/db/andydriver.net.db"));
set_include_path(join(PATH_SEPARATOR, array(dirname(__FILE__) . '/controllers', dirname(__FILE__) . '/models', get_include_path())));
$template = Minim_Template::getInstance();
$template->addTemplatePath(dirname(__FILE__) . '/templates');
$router = new Minim_Router();
$router->get('^/?$')->routesTo('Home');
$router->get('^/blog/post$')->routesTo('Blog', 'newPostForm');
$router->post('^/blog/post$')->routesTo('Blog', 'createNewPost');
$router->get('^/blog/(?P<year>\\d{4})/(?P<month>\\d{2})/(?P<slug>[-a-z0-9]+)$')->routesTo('Blog', 'readPost');
// atom publishing protocol URLs
$router->get('^/blog/servicedocument$')->routesTo('Blog', 'atomCollections');
$router->post('^/blog/posts/?$')->routesTo('Blog', 'atomAddPost');
$router->get('^/blog/posts/?$')->routesTo('Blog', 'atomListPosts');
$router->get('^/blog/posts/(?P<id>\\d+)$')->routesTo('Blog', 'atomGetPost');
$router->put('^/blog/posts/(?P<id>\\d+)$')->routesTo('Blog', 'atomEditPost');
$router->delete('^/blog/posts/(?P<id>\\d+)$')->routesTo('Blog', 'atomDeletePost');
$router->routeRequest();
echo "<br>\nTook: ", sprintf("%.4f", microtime(TRUE) - $start), "s<br>\n";
Exemple #4
0
 function render($template, $context = array())
 {
     Minim_Template::getInstance()->render($template, $context);
 }