X-Git-Url: https://git.cweiske.de/phinde.git/blobdiff_plain/226508cd8d3e8c147ad314a0de483e08be71c254..d6c817be8dfb9d41ea3f19cecd90619cde97209d:/www/www-header.php diff --git a/www/www-header.php b/www/www-header.php index 60adacf..e7c4542 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -12,6 +12,14 @@ $GLOBALS['twig'] = new \Twig_Environment( ); $GLOBALS['twig']->addExtension(new \Twig_Extension_Debug()); +$twig->addFunction('ellipsis', new \Twig_Function_Function('\phinde\ellipsis')); +function ellipsis($text, $maxlength) +{ + if (strlen($text) > $maxlength) { + $text = substr($text, 0, $maxlength - 1) . '…'; + } + return $text; +} function render($tplname, $vars = array(), $return = false) { @@ -19,6 +27,7 @@ function render($tplname, $vars = array(), $return = false) //$vars['htmlhelper'] = new HtmlHelper(); } $vars['apptitle'] = 'cweiske.de search'; + $vars['baseUrl'] = '/'; $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm'); if ($return) {