We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Raw HTML in volt

How do I pass raw html into volt?

I need to print {{ hello }} into my html document, how is this done, without phalcon compile it to <?php echo $hello; ?>


Do you mean literally print?

{{ hello }}

It would comple it: <?php echo "{{ hello }}"; ?>

Yes, i really need to see {{ hello }}

The reason is that I use handlebars, so I can't use the tag {{ }} - Unless I make volt ignore the tag..

edited Aug '16

Doesn't {{ "{{ hello }}" }} do what you need?

You can add custom function for volt https://docs.phalcon.io/en/latest/reference/volt.html

$compiler->addFunction('print', function($resolvedArgs, $exprArgs)  use ($compiler) {
    return "print(". $compiler->expression($exprArgs[0]['expr']) .")";

And use it in volt:

I want to print {% print("hello") %}

Sorry for the late reply, I used Miguel Nunes answer

Thanks for all who spend their time helping me out :-)