How mature is Volt?
I've tried 0.9.0, 0.9.1, master and 1.0.0 and this issue keeps staying in there. Maybe I do something wrong, but it's very simple actually.
I get this:
PhalconException: Syntax error, unexpected token %} in ../app/views/examples/index.volt on line 1
By typing this in index.volt:
{% cache %} test {% endcache %}
If I use this:
{% cache test %} test {% endcache %}
I get:
Notice: Undefined variable: test in .... index.volt on line 1
I also saw the filter 'capitalize' didn't work and some other problems with Volt. I can't get it to work from the examples in the tutorial about Volt.
So my question is: how mature is Volt? Thanks, and keep up the good stuff!
Hi You forgot the quotes
{% cache "test" %}
test
{% endcache %}
Ah, thanks! I didn't forgot them, they weren't in the example I found somewhere. But it still doesn't explain why the capitalize filter doesn't work. I'll try how far I can go with the tutorials.
I can confirm it, capitalize isn't work
{{ "hello"|capitalize }}
// Phalcon\Mvc\View\Exception
// Unknown filter "capitalize"
I tried to register an alternative filter for the compiler, like ucwords or ucfirst, but that doesn't work either.
Filter registration works fine
$volt = new \Phalcon\Mvc\View\Engine\Volt($this->view, $this->di);
$compiler = $volt->getCompiler();
$compiler->addFilter('ucwords', 'ucwords');
var_dump($compiler->compileString('{{ "hello"|ucwords }}'));
// string '<?php echo ucwords('hello'); ?>' (length=31)
I have issued a fix for capitalize in the 1.0.0. branch