Reputation: 3245
I added Twig template engine to CodeIgniter 2 using this library:
https://github.com/dilantha/codeigniter-twig
Everything works except dum() function. Using dump troughs this error:
Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unknown "dump" function. Did you mean "var_dump", "debug_zval_dump", "xdebug_var_dump", "mysqli_dump_debug_info", "xdebug_dump_superglobals", "xdebug_dump_aggr_profiling_data"?
This is my Twig Template:
{{ dump() }}
And this is my controller:
public function index()
{
$data = ['title' => 'Title' ];
$this->twig->display('dump.twig', $data);
}
CodeIgniter Version: 2.2.0
Twig Version: 1.35.4
Upvotes: 1
Views: 1317
Reputation: 3245
This option is not enabled by default in version 1.and codeigniter-twig code missed this. I added this code to Twig.php library and the problem solved:
if ($debug) {
$this->_twig->addExtension(new Twig_Extension_Debug());
}
I will report this to the author.
Upvotes: 1