Can we use variable variables in volt?

As title said, I want to use variable variables in volt...

We can do that easy with raw php template:

$a = 'hello';  
$$a = 'world';
echo "$a ${$a}";

Can we do this in volt?

{% set account = "user_"~item~"_account" %}

and use this variable like this:

{{ {{account}} }}


81.7k

Sorry, but such syntax is not supported by Volt, since you can also embed php code in volt templates, you can use:

{% set account = "user_"~item~"_account" %}
<?php echo $$account; ?>


4.0k

@Phalcon you are right.... Do you think is that necessary to be implemented in volt?



81.7k

Well, Volt (as Jinja) is intended to provide a simple syntax to help designers to create templates and this functionality is not clear so I think that's the reason because Jinja doesn't implement it too