6 Commits
3.0 ... 3.0.2

Author SHA1 Message Date
User
d09bd2836a 20240410#12 2024-04-10 03:49:52 +03:00
User
e96bc71eff 20240410#11 2024-04-10 03:46:37 +03:00
User
3b4836bb5e 20240410#10 2024-04-10 03:42:03 +03:00
User
94ada77e89 20240410#9 2024-04-10 03:39:40 +03:00
User
bbaf319dc8 20240410#7 2024-04-10 03:27:21 +03:00
User
763228a883 20240410#6 2024-04-10 03:21:30 +03:00

View File

@@ -27,7 +27,7 @@ class Content implements TemplateInterface {
/** @inheritDoc */
public function setSubtemplatePath(string $subtemplatePath = "") : TemplateInterface {
ContentData::$subtemplatePath = ContentData::$basePath.$subtemplatePath;
ContentData::$subtemplatePath = ContentData::$basePath.rtrim($subtemplatePath, '/');
return $this;
}
@@ -59,7 +59,7 @@ 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("Subtemplate ".ContentData::$subtemplatePath.$subtemplate. " is not found");
foreach ($resource as $resKey => $resVal){
$this->{$resKey} = $resVal;
}
@@ -81,7 +81,7 @@ 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");
if(empty($incFile) || !file_exists(ContentData::$subtemplatePath.$incFile)) throw new AppError("Inc file ".$incFile." is not found");
ob_start(); include ContentData::$subtemplatePath.$incFile; $out = ob_get_contents(); ob_end_clean();
return $out;
}