diff options
Diffstat (limited to 'src/index.php')
| -rw-r--r-- | src/index.php | 5 | 
1 files changed, 4 insertions, 1 deletions
| diff --git a/src/index.php b/src/index.php index 4c53f0c..b7e0397 100644 --- a/src/index.php +++ b/src/index.php @@ -149,7 +149,7 @@ function reArrayFiles(&$file_post) {      return $file_ary;  } -function render(string $page, array $context = []): void { +function render(string $page, array $context = [], array $functions = []): void {      $defaultTemplate = "bootstrap-3"; // bootstrap-3 is the default for backwards compatibility      $templateDir = __ROOT__ . "/application/templates"; @@ -193,6 +193,9 @@ function render(string $page, array $context = []): void {      $twig->addFilter(new TwigFilter("base64_encode", base64_encode(...)));      $twig->addFilter(new TwigFilter("base64_decode", base64_decode(...))); +    foreach ($functions as $fnName => $callable) +        $twig->addFunction(new TwigFunction("ctx_$fnName", $callable)); +      echo $twig->render($page, [          "g" => [              "get" => &$_GET, |