mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 02:46:29 +00:00
fix highlighting of snippet in recipes doc
This commit is contained in:
+7
-7
@@ -246,14 +246,14 @@ Validating the Template Syntax
|
||||
When template code is providing by a third-party (through a web interface for
|
||||
instance), it might be interesting to validate the template syntax before
|
||||
saving it. If the template code is stored in a `$template` variable, here is
|
||||
how you can do it:
|
||||
how you can do it::
|
||||
|
||||
try {
|
||||
$twig->parse($twig->tokenize($template));
|
||||
try {
|
||||
$twig->parse($twig->tokenize($template));
|
||||
|
||||
// the $template is valid
|
||||
} catch (Twig_Error_Syntax $e) {
|
||||
// $template contains one or more syntax errors
|
||||
}
|
||||
// the $template is valid
|
||||
} catch (Twig_Error_Syntax $e) {
|
||||
// $template contains one or more syntax errors
|
||||
}
|
||||
|
||||
.. _callback: http://www.php.net/manual/en/function.is-callable.php
|
||||
|
||||
Reference in New Issue
Block a user