Some Monocotyledonous Plant Families

  • Working with Ajax means that the same content is sometimes displayed as is, and sometimes decorated with a layout. As Twig layout template names can be any valid expression, you can pass a variable that evaluates to true when the request is made via Ajax and choose the layout accordingly:

    {% extends request.ajax ? "base_ajax.html" : "base.html" %}
    {% block content %}
        This is the content to be displayed.
    {% endblock %}

    When including a template, its name does not need to be a string. For instance, the name can depend on the value of a variable.