Phalcon Framework and Volt Templating

Why Phalcon?

Yes, because it’s fast and light.

But please remember, when you are using volt templating, you will find the problem when you want to add the attributes inside the textField() tag.

When you are not using volt, it should be like this.

echo $this->tag->textField(array("name", "class"=>"tes"));

But when you are using volt, from the documentation, you have to do like this.

{{ textField("name", "class":"tes") }}

But you will see this error.

Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /var/www/phalcon/cache/volt/%%var%%www%%phalcon%%app%%views%%signup%%index.volt.php on line 7

I’ve googled about this problem and found this link, but still no luck.

Finally, I found the solution. I tried to make an array for the attributes

{{ textField(["name", "class":"tes"]) }}

And it worked very well on the latest build (I am using version 2.0.7). 🙂

P.S: I hope this is not the one and only posting for this year 😛

You may also like

Leave a Reply

Your email address will not be published.