[Templating] added Engine::exists()
This commit is contained in:
parent
0208800459
commit
478fcca88d
@ -123,6 +123,28 @@ class Engine implements \ArrayAccess
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the template exists.
|
||||||
|
*
|
||||||
|
* @param string $name A template name
|
||||||
|
*
|
||||||
|
* @return Boolean true if the template exists, false otherwise
|
||||||
|
*/
|
||||||
|
public function exists($name)
|
||||||
|
{
|
||||||
|
list($tpl, $options) = $this->splitTemplateName($name);
|
||||||
|
|
||||||
|
$template = $this->loader->load($tpl, $options);
|
||||||
|
|
||||||
|
if (false === $template) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->cache[$name] = array($tpl, $options, $template);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs a rendered template.
|
* Outputs a rendered template.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user