3 require_once __DIR__ . '/../src/init.php';
5 $GLOBALS['twig'] = new \Twig_Environment(
6 new \Twig_Loader_Filesystem(__DIR__ . '/../data/templates'),
8 //'cache' => '/path/to/compilation_cache',
12 $GLOBALS['twig']->addExtension(new \Twig_Extension_Debug());
14 $twig->addFunction('ellipsis', new \Twig_Function_Function('\phinde\ellipsis'));
15 function ellipsis($text, $maxlength)
17 if (strlen($text) > $maxlength) {
18 $text = substr($text, 0, $maxlength - 1) . '…';
23 function render($tplname, $vars = array(), $return = false)
25 if (!isset($vars['htmlhelper'])) {
26 //$vars['htmlhelper'] = new HtmlHelper();
28 $vars['apptitle'] = $GLOBALS['phinde']['apptitle'];
29 $vars['baseUrl'] = '/';
31 $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
33 return $template->render($vars);
35 echo $template->render($vars);