Skip to content

Commit

Permalink
[Templating] added Engine::exists()
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Aug 29, 2010
1 parent 0208800 commit 478fcca
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Symfony/Component/Templating/Engine.php
Expand Up @@ -123,6 +123,28 @@ public function render($name, array $parameters = array())
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.
*
Expand Down

0 comments on commit 478fcca

Please sign in to comment.