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