From 754a23706ac854e94d995963fb7272295d5832ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Tue, 11 May 2021 19:33:13 +0200 Subject: [PATCH] MAPG-238 include view with @include --- src/View/Linker.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/View/Linker.php b/src/View/Linker.php index a068e61..4cefbcc 100644 --- a/src/View/Linker.php +++ b/src/View/Linker.php @@ -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]); -- 2.45.2