symfony - twig {% image string %} with concated string -
i have code that
{% in 1..25 %} <li class="span4"> {% set screen = '@tfptportfoliobundle/resources/public/images/bekic/screen' ~ ~ '.jpg' %} <a href="#mymodal" class="thumbnail" data-toggle="modal">{% image screen %} <img src="{{ asset_url }}" alt="młody lider innowacji" /> {% endimage %}</a> </li> {% endfor %}
but symfony throws error "unexpected token "name" of value "screen"" on lane
<a href="#mymodal" class="thumbnail" data-toggle="modal">{% image screen %}
how can concat string use asset url?
so works:
{% in 1..25 %} <li class="span4"> {% set screen = 'bundles/tfptportfolio/images/bekic/screen' ~ ~ '.jpg' %} <a href="#mymodal" class="thumbnail" data-toggle="modal"> <img src="{{ asset(screen) }}" alt="młody lider innowacji" /> </a> </li> {% endfor %}
obviously must have executed command app/console assets:install --symlink
create links on web directories.
edit:
enter tag assetic variable in way did not possible. must declare variable in config.yml.
here can see documentation: documentation assetic.
at moment way described above.
Comments
Post a Comment