{# This is a Jinja comment. Note the delimiter pair, which can't be repeated within the comment without breaking the template. The HTML in this if's block will only be generated if the condition is true. {% / %} pairs are used to delimit control staements. {{ / }} pairs are used to inject values into the HTML document. Below, these pairs are used to inject the URLs for the corresponding functions into the HTML document and for injecting whichPage's and i's value. whichPage is a parameter passed to Jinja via render_template. Note that the session dict is available as a global. There are a couple other globals available; check the Flask documentation. Always use url_for() rather than hardcoding URLs for your Python functions. If you hardcode the URLs, you'll have to change them when you transition from using the development server to Apache, and vice versa. To see the actual HTML document that a template generates, you can usually issue a Ctrl-u to the displayed document and your web browser will open a tab displaying the raw HTML. Please put effort into writing your templates so that they're easily understandable by others. #} {% if 1 <= whichPage <= 4 %} You are currently on page {{ whichPage }}

{% endif %} {% for i in range(1, 5) %} {% if i == whichPage %} Page {{ i }} {% else %} Page {{ i }} {% endif %} , which you have chosen {{ session['counts'][i] }} times.
{% endfor %}

Reset