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.

How to join variable in string use Volt template

Hi, I have a declared value in the controller named: {{ themeUrl }}. I want to Join this variable to string in Volt template it works well with php: <?php $this->assets->collection('footer')->addJs($themeUrl.'/js/icheck.min.js');?>

But with Volt tempalte is Error: {% do assets.collection('footer').addJs({{ themeUrl }}'/js/icheck.min.js') %}} Please help me



2.7k
Accepted
answer

The ~ concatinates strings in volt and you have too many curly bracers around themeUrl

addJs(themeUrl ~ '/js/icheck.min.js')

Yes, thank for so much