MAPG-238 include view with @include

This commit is contained in:
Bence Pőcze 2021-05-11 19:33:13 +02:00
parent c02f595606
commit 1075533b3c
Signed by: bence
GPG Key ID: AA52B11A3269D1C1

View File

@ -97,7 +97,12 @@ class Linker
fwrite($outputFileHandle, $extra[0]);
while (($line = fgets($inputFileHandle)) !== false) {
fwrite($outputFileHandle, $line);
if (preg_match('/^\s*@include\((.*)\)\s*$/', $line, $matches) === 1) {
$include = file_get_contents(ROOT . '/views/' . $matches[1] . '.php');
fwrite($outputFileHandle, $include);
} else {
fwrite($outputFileHandle, $line);
}
}
fwrite($outputFileHandle, $extra[1]);