Compare commits

..

2 Commits

Author SHA1 Message Date
6fdd25ae4b
Merge pull request 'MAPG-238 include view with @include' (#19) from feature/MAPG-238-include-possibility-for-templating-engine into master
All checks were successful
soko-web/pipeline/head This commit looks good
Reviewed-on: #19
2023-05-28 15:45:10 +02:00
754a23706a
MAPG-238 include view with @include
All checks were successful
soko-web/pipeline/pr-master This commit looks good
2023-05-27 10:56:20 +02:00

View File

@ -97,7 +97,12 @@ class Linker
fwrite($outputFileHandle, $extra[0]); fwrite($outputFileHandle, $extra[0]);
while (($line = fgets($inputFileHandle)) !== false) { 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]); fwrite($outputFileHandle, $extra[1]);