How to write that path in string to be parsed - Twig -
i set links in way in twig:
{% set link = '<a href="">('~product.price~)'~product.name~'</a>' %} the problem how fill link
{% set link = '<a href="'~{{ path('restaurant') }}~'">('~product.price~)'~product.name~'</a>' %} this gives me error: a hash key must quoted string, number, name, or expression enclosed in parentheses (unexpected token "punctuation" of value "{"
{% set link = '<a href="{ path('restaurant') }}">('~product.price~)'~product.name~'</a>' %} unexpected token "name" of value "restaurant" ("end of statement block" expected)
can please me :(
the link have id argument.
the thing can think of writing filter takes te id argument , replaces empty link, i'm not quite sure work, , doesn't seem solution.
you should not use parentheses within {% %} blocks.
furthermore, unless have specific reason putting whole markup link in variable, might want consider creating links this:
<a href="{{ path('restaurant') }}">{{ product.name }}</a>
Comments
Post a Comment