X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/82d22f5e2176392ca2389df0e47a29092cf38089..ce742998b26908a9407f77a0f4ed5dbb9da9f273:/www/www-header.php diff --git a/www/www-header.php b/www/www-header.php index 9aa8732..cda7047 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -68,6 +68,14 @@ $twig = new \Twig_Environment( 'debug' => true ) ); +$twig->addFunction('ntext', new \Twig_Function_Function('\phorkie\ntext')); +function ntext($value, $singular, $plural) +{ + if (abs($value) == 1) { + return sprintf($singular, $value); + } + return sprintf($plural, $value); +} //$twig->addExtension(new \Twig_Extension_Debug()); if (!isset($noSecurityCheck) || $noSecurityCheck !== true) { @@ -76,6 +84,10 @@ if (!isset($noSecurityCheck) || $noSecurityCheck !== true) { function render($tplname, $vars = array()) { + $vars['baseurl'] = '/'; + if (!empty($GLOBALS['phorkie']['cfg']['baseurl'])) { + $vars['baseurl'] = $GLOBALS['phorkie']['cfg']['baseurl']; + } $vars['css'] = $GLOBALS['phorkie']['cfg']['css']; $vars['title'] = $GLOBALS['phorkie']['cfg']['title']; $vars['topbar'] = $GLOBALS['phorkie']['cfg']['topbar'];