3 Commits
1.0 ... 1.x

Author SHA1 Message Date
User
1f77fe9ee9 20230926#3 2023-09-26 21:31:56 +03:00
User
eaa314786c 20230626#2 2023-06-26 20:12:23 +03:00
User
c9913b99a4 20230626#1 2023-06-26 19:58:03 +03:00
2 changed files with 5 additions and 3 deletions

View File

@@ -10,12 +10,12 @@ Stable version
composer require rmphp/content composer require rmphp/content
``` ```
```bash ```bash
composer require rmphp/content:"^1.0" composer require rmphp/content:"^1.1"
``` ```
Dev version contains the latest changes Dev version contains the latest changes
```bash ```bash
composer require rmphp/content:"1.0.x-dev" composer require rmphp/content:"1.x-dev"
``` ```

View File

@@ -2,6 +2,7 @@
namespace Rmphp\Content; namespace Rmphp\Content;
use Rmphp\Foundation\Exceptions\AppError;
use Rmphp\Foundation\Exceptions\AppException; use Rmphp\Foundation\Exceptions\AppException;
use Rmphp\Foundation\TemplateInterface; use Rmphp\Foundation\TemplateInterface;
@@ -140,9 +141,10 @@ class Content implements TemplateInterface {
/** /**
* @return string * @return string
* @throws AppException
*/ */
public function getResponse(): string { public function getResponse(): string {
if (empty($this->template) || !file_exists($this->template)) return ''; if (empty($this->template) || !file_exists($this->template)) throw new AppError("Invalid template file");
ob_start(); include $this->template; $out = ob_get_contents(); ob_end_clean(); ob_start(); include $this->template; $out = ob_get_contents(); ob_end_clean();
return $out; return $out;
} }