php - SYMFONY 3 Twig conditions route

858

I would like to know how with twig display something considering the route.

{% if visual|default %}
        {{- wc_simple_visual(visual) -}}
      {% else %}
        <div >
         //Display the image in functions of the routn name 
        {% if app.request.get('_route') != 'live' AND f app.request.get('_route') != 'contact' %}
          <img src="/{{ asset_version('img/live-image.jpg') }}" alt="{% if title %}{{ title }}{% endif %}" >
      {% else %}
    <img src="/{{ asset_version('img/contact-image.jpg') }}" alt="{% if title %}{{ title }}{% endif %}" >
        </div>
      {% endif %}

but like this it doesn't works, thx.

People are also looking for solutions to the problem: php - How many columns in mysql

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.