git.shiar.nl
/
minimedit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
page: include scripts from placeholders
[minimedit.git]
/
page.php
diff --git
a/page.php
b/page.php
index 2c3a68ae4e172c86524bbe91004c551bec0794b3..c2dfd9f0ed6089d0f9171c16e8eb02c16fa62341 100644
(file)
--- a/
page.php
+++ b/
page.php
@@
-23,12
+23,19
@@
function getoutput($blocks = [])
}
return preg_replace_callback(
}
return preg_replace_callback(
- '< \[\[ ([^]]*) \]\] >x',
+ '< \[\[ ([^]
/]+) ([^]
]*) \]\] >x',
function ($sub) use ($blocks) {
function ($sub) use ($blocks) {
- list ($placeholder, $name) = $sub;
+ list ($placeholder, $name
, $params
) = $sub;
if (isset($blocks[$name])) {
$html = $blocks[$name];
}
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 = '<strong class="warn"><em>'.$name.'</em> ontbreekt</strong>';
}
else {
$html = '<strong class="warn"><em>'.$name.'</em> ontbreekt</strong>';
}