Variable not being assigned: Unexpected token "name" of value "as" ("end of statement block" expected)

Practice




Unexpected token "name" of value "as" ("end of statement block" expected) in


home/src/Acme/UserBundle/Resources/views/Default/tpl.html.twig


the template has an attempt to assign a twig variable
....
{% set name as "value" %}
...

try not assigning a variable but instead capturing from the html body

{% if (foo==0 ) %}{% set foo2 %}text1{% endset %}{% else %}{% set foo2 %}text2{% endset %}{% endif %}

tried it this way - seems to work

{% set name= "value" %}

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Running server side scripts using PHP as an example (LAMP)"

Terms: Running server side scripts using PHP as an example (LAMP)