On Thu, May 28, 2009, Masklinn <maskl...@masklinn.net> wrote:

>> I need to create some templates that will cover a number of cases:
>>
>>    display navigation menu: yes or no
>>    display additional info box: yes or no
>>
>> In other words, there are a total of four cases that need to be  
>> provided for.
>>
>> I understand how to use template inheritance so that a derived  
>> template
>> will contain a block that overrides the default presence of the
>> navigation menu.
>>
>> I could create a total of four derived templates, one for each case;
>> that would be OK too.
>>
>> However, the number of derived templates rises exponentially. If I
>> needed to cover a couple of additional options, say:
>>
>>    use low-bandwidth styling: yes or no
>>    display secret information: yes or no
>>
>> then I'd need 16 templates to extend the base.
>>
>> There must be a better way to do this - what is it?
>>
>Template inclusion instead of template inheritance?

You mean, by using a series of tags like:

{% if [condition] %}
    {% include "navigationmenu.html" %}
{% endif %}

{% if [condition2] %}
    {% include "additionalinfo.html" %}
{% endif %}

and so on?

Daniele


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to