cphalcon
cphalcon copied to clipboard
volt compiler do not parse dollar sign
Below is the code that caused the error:
$str = '<a href="{{ url(\'country/edit/\'.$id) }}">edit</a>';
$compiler = new \Phalcon\Mvc\View\Engine\Volt\Compiler();
$parsed_string = $compiler->compileString($str);
error message: Scanning error before 'id) }}">edit...' in eval code on line 1
expected result is :
<a href="<?php echo $this->url->get('country/edit/'.$id); ?>">edit</a>
<b>Notice</b>: Undefined property: Marvel\Library\Datatables::$url in <b>C:\xampp\htdocs\marvel\app\library\Datatables.php(135) : eval()'d code</b> on line <b>1</b><br />
<br />
<b>Fatal error</b>: Call to a member function get() on a non-object in <b>C:\xampp\htdocs\marvel\app\library\Datatables.php(135) : eval()'d code</b> on line <b>1</b><br />
Try this:
<a href="{{ url(\'country/edit/\' ~ id) }}">edit</a>';