cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

volt compiler do not parse dollar sign

Open joeyew opened this issue 13 years ago • 2 comments

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>

joeyew avatar Aug 28 '13 08:08 joeyew

<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 />

joeyew avatar Aug 28 '13 10:08 joeyew

Try this:

<a href="{{ url(\'country/edit/\' ~ id) }}">edit</a>';

niden avatar Sep 11 '13 14:09 niden