<div dir="ltr">Not always sometimes you want to show some template code (You have a blog about web dev) and sometimes you want to nest some code.<br><br><div class="gmail_quote">On Sun, Jan 11, 2009 at 10:04 PM, Diez B. Roggisch <span dir="ltr"><<a href="mailto:deets@nospam.web.de">deets@nospam.web.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Alex K schrieb:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
While building a website using template inheritance one usually does<br>
the following:<br>
<br>
fetch from database<br>
fetch from some more data from database<br>
... << more required computations<br>
then at the end render the template with the fetched data<br>
<br>
Without template inheritance one usually does the following:<br>
<br>
fetch from database<br>
render this part of the site with this fetched data<br>
fetch some more data from the database<br>
render this other part of the site with the fetched data<br>
...<br>
etc<br>
<br>
The first approach is much more elegant and leads to easier to<br>
maintain code. However the user will have to wait till the end of the<br>
fetching (long computations) before any rendering can take place. In<br>
the second approach however the site loads as we are fetching the data<br>
which is more convenient to the user.<br>
<br>
Am I correct to assume this? Is there a way to get the best of both<br></div>
worlds? Thank you.<br>
</blockquote>
<br>
I don't think that the question of inheritance or not is really relevant here.<br>
<br>
It's a matter of how the templating system is written - does it collect all the data beforehand, or not, is it potentially using e.g. generators and so forth.<br>
<br>
And of course how the programmer uses the templating system. does he fetch all the data beforehand, or does he use lazy generation approachs - again, e.g. generators, or callbacks.<br>
<br>
Besides, *usually* the 20-39Kb of a website itself aren't the problem I'd say - loading referenced resources is much more of an issue.<br>
<br>
And AFAIK the render-mode matters, too. If the site is XHTML-compliant, the browser can start the rendering once the HTML is complete - otherwise, it might wait until the referenced resources are all loaded to calculate the layout.<br>
<font color="#888888">
<br>
Diez</font><div><div></div><div class="Wj3C7c"><br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.astorandblack.com/">http://www.astorandblack.com/</a><br>
</div>