Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d09bd2836a | ||
|
|
e96bc71eff | ||
|
|
3b4836bb5e | ||
|
|
94ada77e89 | ||
|
|
bbaf319dc8 | ||
|
|
763228a883 |
@@ -27,7 +27,7 @@ class Content implements TemplateInterface {
|
|||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
public function setSubtemplatePath(string $subtemplatePath = "") : TemplateInterface {
|
public function setSubtemplatePath(string $subtemplatePath = "") : TemplateInterface {
|
||||||
ContentData::$subtemplatePath = ContentData::$basePath.$subtemplatePath;
|
ContentData::$subtemplatePath = ContentData::$basePath.rtrim($subtemplatePath, '/');
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ class Content implements TemplateInterface {
|
|||||||
public function addSubtemplate(string $point, string $subtemplate, array $resource = []) : void {
|
public function addSubtemplate(string $point, string $subtemplate, array $resource = []) : void {
|
||||||
if (empty(ContentData::$subtemplatePath))throw new AppError("SubtemplatePath is not defined");
|
if (empty(ContentData::$subtemplatePath))throw new AppError("SubtemplatePath is not defined");
|
||||||
if (empty($point)) throw new AppError("Empty point");
|
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){
|
foreach ($resource as $resKey => $resVal){
|
||||||
$this->{$resKey} = $resVal;
|
$this->{$resKey} = $resVal;
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ class Content implements TemplateInterface {
|
|||||||
foreach ($resource as $resKey => $resVal){
|
foreach ($resource as $resKey => $resVal){
|
||||||
$this->{$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();
|
ob_start(); include ContentData::$subtemplatePath.$incFile; $out = ob_get_contents(); ob_end_clean();
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user