Created
March 7, 2012 01:51
-
-
Save JoeCianflone/1990387 to your computer and use it in GitHub Desktop.
Bug with Twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Somewhere in a Class... | |
Twig_Autoloader::register(); | |
$this->loader = new Twig_Loader_Filesystem($this->CI->config->item('filepath')); | |
$this->twig = new Twig_Environment($this->loader, $this->configs['env']); | |
$this->twig->setLexer(new Twig_Lexer($this->twig, $this->configs['tags'])); | |
$tags = array('if'); | |
$filters = array('upper'); | |
$methods = array( | |
'Article' => array('getTitle', 'getBody'), | |
); | |
$properties = array( | |
'Article' => array('title', 'body'), | |
); | |
$functions = array('range'); | |
$policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); | |
$sandbox = new Twig_Extension_Sandbox($policy, true); // This should global so no need to {% sandbox %} | |
$this->twig->addExtension($sandbox); | |
// In my template I do this... | |
<html> | |
{% block content %} | |
{% endblock %} | |
</html> | |
// In the child.... | |
{% extends "template.twig" %} | |
{% block content %} | |
{{ parent() }} | |
{{ my_var|url_encode }} | |
{%% endblock } | |
// I should get an error, but I don't the code runs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment