From: Mischa POSLAWSKY Date: Wed, 2 May 2018 12:52:16 +0000 (+0200) Subject: page: include scripts from placeholders X-Git-Tag: v3.0~5 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/f3264dbe1629fb53f70d1284190fe4781b61d6e5 page: include scripts from placeholders --- 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'; }