From a576bf063865d558c9cbed31b8c03bfe459c6394 Mon Sep 17 00:00:00 2001 From: User Date: Wed, 10 Apr 2024 02:54:51 +0300 Subject: [PATCH] 20240410#5 --- src/Content.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Content.php b/src/Content.php index f36f70c..1feea90 100644 --- a/src/Content.php +++ b/src/Content.php @@ -21,13 +21,13 @@ class Content implements TemplateInterface { $this->{$resKey} = $resVal; } ContentData::$basePath = dirname(__DIR__, 4); - ContentData::$template = ContentData::$basePath.'/'.$template; + ContentData::$template = ContentData::$basePath.$template; return $this; } /** @inheritDoc */ public function setSubtemplatePath(string $subtemplatePath = "") : TemplateInterface { - ContentData::$subtemplatePath = ContentData::$basePath.'/'.$subtemplatePath; + ContentData::$subtemplatePath = ContentData::$basePath.$subtemplatePath; return $this; } @@ -59,11 +59,11 @@ class Content implements TemplateInterface { public function addSubtemplate(string $point, string $subtemplate, array $resource = []) : void { if (empty(ContentData::$subtemplatePath))throw new AppError("SubtemplatePath is not defined"); if (empty($point)) throw new AppError("Empty point"); - if (empty($subtemplate) || !file_exists(ContentData::$subtemplatePath."/".$subtemplate)) throw new AppError(ContentData::$subtemplatePath."/".$subtemplate. " is not found"); + if (empty($subtemplate) || !file_exists(ContentData::$subtemplatePath.$subtemplate)) throw new AppError(ContentData::$subtemplatePath.$subtemplate. " is not found"); foreach ($resource as $resKey => $resVal){ $this->{$resKey} = $resVal; } - ob_start(); include ContentData::$subtemplatePath."/".$subtemplate; ContentData::$content[$point][] = ob_get_contents(); ob_end_clean(); + ob_start(); include ContentData::$subtemplatePath.$subtemplate; ContentData::$content[$point][] = ob_get_contents(); ob_end_clean(); } /** @@ -81,8 +81,8 @@ class Content implements TemplateInterface { foreach ($resource as $resKey => $resVal){ $this->{$resKey} = $resVal; } - if(empty($incFile) || !file_exists(ContentData::$subtemplatePath."/".$incFile)) throw new AppError("Empty inc file"); - ob_start(); include ContentData::$subtemplatePath."/".$incFile; $out = ob_get_contents(); ob_end_clean(); + if(empty($incFile) || !file_exists(ContentData::$subtemplatePath.$incFile)) throw new AppError("Empty inc file"); + ob_start(); include ContentData::$subtemplatePath.$incFile; $out = ob_get_contents(); ob_end_clean(); return $out; }