aboutsummaryrefslogtreecommitdiff
path: root/www/www-header.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2016-02-03 17:23:06 +0100
committerChristian Weiske <cweiske@cweiske.de>2016-02-03 17:23:06 +0100
commite5c7780adb59e8038a040a1e534a4cee1fac8cd8 (patch)
tree2f8be5ac975398a7cb1084dd13c9350514119d85 /www/www-header.php
parent226508cd8d3e8c147ad314a0de483e08be71c254 (diff)
downloadphinde-e5c7780adb59e8038a040a1e534a4cee1fac8cd8.tar.gz
phinde-e5c7780adb59e8038a040a1e534a4cee1fac8cd8.zip
filtering works
Diffstat (limited to 'www/www-header.php')
-rw-r--r--www/www-header.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/www/www-header.php b/www/www-header.php
index 60adacf..2ec8c2f 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)
{