Rendering a template with multiple blocks

60 views
Skip to first unread message

prost...@gmail.com

unread,
Mar 11, 2012, 12:20:14 PM3/11/12
to h2o-temp...@googlegroups.com
I make a module system. There are a main module, which load main template and other modules.
Main template contain some blocks, like:

{% block static %}
{% endblock %}   
 
{% block poll %}
{% endblock %}

Each module (static, poll) must load subtemplate work out and replace the appropriate block in main template.
I cant make it with inheritance.
If there any method that allow load subtemplate and set the block content in main module?

Taylor luk

unread,
Mar 11, 2012, 5:35:38 PM3/11/12
to h2o-temp...@googlegroups.com
Hi there,

{% extends 'base' %}
{% block static %}
   {% include 'subtpl' $}

I don't think template inheritance works together with loading sub-template at the same time/ It's usually one or the other and i recommend look into putting static markup in base template.

prost...@gmail.com

unread,
Mar 12, 2012, 9:58:49 PM3/12/12
to h2o-temp...@googlegroups.com
{% include %} - makes that I need. But main module (template) doesn't  know about other modules.
I need, that poll (for example) module build in main template by himself.

main.tpl:
{% include "./tpl/poll/poll.tpl" %} - Markup maker shouldn't assign path to other modules templates. That should do the developers of the module (poll) inside his module

понедельник, 12 марта 2012 г. 6:35:38 UTC+9 пользователь Taylor luk написал:
Reply all
Reply to author
Forward
0 new messages