Opened 11 years ago

Closed 11 years ago

#6370 closed (wontfix)

Templates {% block %} does not work properly in {% if %}

Reported by: brandemk@… Owned by: nobody
Component: Template system Version: 0.96
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When I use the following code:
{% if site %}
<title>{% block titlebar %}{% endblock %} § {{ }}</title>
{% else %}
<title>{% block titlebar %}{% endblock %} § Website</title>
{% endif %}

I get an error: titlebar block appears more than once.

While I do not see why an block cannot appear more than once, I do not see a reason that that cannot be valid. The titlebar block will only be rendered once.

Change History (2)

comment:1 Changed 11 years ago by Collin Grady <cgrady@…>

I'm pretty sure this is by design, because of how template extension works - you simply need to move your if.

<title>{% block titlebar %}{% endblock %} § {% if site %}{{ }}{% else %}Website{% endif %}</title>

Less duplicated html, yet does the exact same thing your does.

comment:2 Changed 11 years ago by Chris Beaven

Resolution: wontfix
Status: newclosed

Yep, it's by design.

Note: See TracTickets for help on using tickets.
Back to Top