From 1075533b3ccfaf7cd61cbe44aa7f1e6ed7ccec33 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 ca67886..c0d63e1 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]);