mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
allow custom template extension
This commit is contained in:
parent
fc56af4ff1
commit
0bec263d78
|
|
@ -58,15 +58,16 @@ abstract class ViewAbstract implements RenderableInterface
|
||||||
/**
|
/**
|
||||||
* Set the template.
|
* Set the template.
|
||||||
*
|
*
|
||||||
* @param string $template View template
|
* @param string $template View template
|
||||||
|
* @param string $extension Extension of the template
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function setTemplate(string $template) : void
|
public function setTemplate(string $template, string $extension = 'tpl.php') : void
|
||||||
{
|
{
|
||||||
$this->template = $template;
|
$this->template = __DIR__ . '/../..' . $template . '.' . $extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -223,8 +224,7 @@ abstract class ViewAbstract implements RenderableInterface
|
||||||
try {
|
try {
|
||||||
\ob_start();
|
\ob_start();
|
||||||
|
|
||||||
$path = __DIR__ . '/../..' . $this->template . '.tpl.php';
|
$path = $this->template;
|
||||||
|
|
||||||
if (!\is_file($path)) {
|
if (!\is_file($path)) {
|
||||||
throw new PathException($path);
|
throw new PathException($path);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user