From f3264dbe1629fb53f70d1284190fe4781b61d6e5 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 2 May 2018 14:52:16 +0200 Subject: [PATCH] page: include scripts from placeholders --- page.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/page.php b/page.php index 2c3a68a..c2dfd9f 100644 --- a/page.php +++ b/page.php @@ -23,12 +23,19 @@ function getoutput($blocks = []) } return preg_replace_callback( - '< \[\[ ([^]]*) \]\] >x', + '< \[\[ ([^]/]+) ([^]]*) \]\] >x', function ($sub) use ($blocks) { - list ($placeholder, $name) = $sub; + list ($placeholder, $name, $params) = $sub; if (isset($blocks[$name])) { $html = $blocks[$name]; } + elseif (file_exists("$name.php")) { + ob_start(); + $Page = $GLOBALS['Page']; + $Args = $GLOBALS['Args'] . $params; + include "$name.php"; + $html = ob_get_clean(); + } else { $html = ''.$name.' ontbreekt'; } -- 2.30.0