This article mainly introduces common statements of the twig template, analyzes the introduction, judgment, jump, and other statements of the twig template in the form of examples, you can refer to the examples in this article to describe common statements in the twig template. We will share this with you for your reference. The details are as follows:
A symfony template is required for the recently written static page, so we will make a summary of the twig template statement: hope it can help beginners.
The code structure is as follows:
{% Extends ':: l_sh_base.html.twig '%} // introduced base template {% block title %} // webpage title merchant center-service category {% endblock %} {% block stylesheets %} // introduced css or js file {parent ()}}
{% Endblock %} {% block header %} // webpage header content {parent () }}{ % endblock %} {% block body %} // webpage subject content
{% For item in appliance %} // for loop statement {item. appliance_name }{% endfor %} src = "{asset ('image/appliance/') }{{ item. image }}" // image path {path ('zm _ shop_appliance_add') }}// href jump path {% if item. status = 1%} // if statement class = "marquee" {% endif %} {% endblock %} {% block footer %} // content at the bottom of the page {parent () }} {% endblock %}
Note that HTML comments cannot be written outside %.
Permanent Address: http://blog.it985.com/12383.html
This article is from the IT985 blog. please indicate the source and relevant links when reprinting.