Пример #1
0
 static function mustache()
 {
     if (isset(self::$mustache)) {
         return self::$mustache;
     }
     return self::$mustache = new Mustache_Engine(array('cache' => APP_FILES_DIR . DS . 'Q' . DS . 'cache' . DS . 'mustache', 'loader' => new Q_Mustache_Loader(), 'partials_loader' => new Q_Mustache_Loader('partials'), 'escape' => function ($value) {
         return htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
     }));
 }
Пример #2
0
function Q_before_Q_view($params, &$result)
{
    extract($params);
    if (strtolower(substr($viewName, -9)) === '.mustache') {
        $result = Q_Mustache::render($viewName, $params);
        return false;
    }
    if (strtolower(substr($viewName, -11)) === '.handlebars') {
        $result = Q_Handlebars::render($viewName, $params);
        return false;
    }
}