We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Problem with Volt functions

Hello guys, Im trying to run the following code:

{{ url('user/' ~ base64_encode(post.User.user_id)) }}

But when Volt compiles a semicolon appears miss placed

<?= $this->url->get('user/' . VoltLib::base64_encode($post->User->user_id);) ?>

Volt cant handle with that?

I guess this should return without semicolon

<?= $this->url->get('user/' . VoltLib::base64_encode($post->User->user_id)) ?>

How can i bypass that? thank you



93.7k
Accepted
answer

Sometimes I get this behaviour also, but sadly I don't remember what was the cause of it. I will write it down next time and share with everyone :)

Try setting post.User.userid to a variable and then pass it to the function.


{% set someVar = post.User.userid %}