mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-27 08:28:40 +00:00
optimize views
This commit is contained in:
parent
35d13cd7db
commit
8c865bb0aa
|
|
@ -77,7 +77,7 @@ class View extends ViewAbstract
|
|||
* @var null|string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected ?string $theme = null;
|
||||
public ?string $theme = null;
|
||||
|
||||
/**
|
||||
* Module name.
|
||||
|
|
@ -85,7 +85,7 @@ class View extends ViewAbstract
|
|||
* @var null|string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected ?string $module = null;
|
||||
public ?string $module = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ abstract class ViewAbstract implements RenderableInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private const BASE_PATH = __DIR__ . '/../..';
|
||||
protected const BASE_PATH = __DIR__ . '/../..';
|
||||
|
||||
/**
|
||||
* Output is buffered
|
||||
|
|
@ -261,6 +261,11 @@ abstract class ViewAbstract implements RenderableInterface
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public function render(...$data) : string
|
||||
{
|
||||
return $this->renderTemplate($this->template, ...$data);
|
||||
}
|
||||
|
||||
protected function renderTemplate(string $template, ...$data) : string
|
||||
{
|
||||
$ob = '';
|
||||
|
||||
|
|
@ -269,7 +274,7 @@ abstract class ViewAbstract implements RenderableInterface
|
|||
\ob_start();
|
||||
}
|
||||
|
||||
$path = $this->template;
|
||||
$path = $template;
|
||||
if (!\is_file($path)) {
|
||||
return '';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user