X-Git-Url: https://git.cweiske.de/phinde.git/blobdiff_plain/226508cd8d3e8c147ad314a0de483e08be71c254..7b5b3205558717de474a2e77b8b3eea768a38f0e:/www/www-header.php diff --git a/www/www-header.php b/www/www-header.php index 60adacf..070c391 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -12,13 +12,22 @@ $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) { if (!isset($vars['htmlhelper'])) { //$vars['htmlhelper'] = new HtmlHelper(); } - $vars['apptitle'] = 'cweiske.de search'; + $vars['apptitle'] = $GLOBALS['phinde']['apptitle']; + $vars['baseUrl'] = '/'; $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm'); if ($return) {