Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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



69.5k
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 %}