<?xml version="1.0" encoding="iso-8859-1"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Comments on article "Cheetah templates overriding"</title>
<link rel="alternate" type="text/html" href="http://base-art.net/Articles/44/" />
<updated>August 12, 2005 12:16 PM</updated>
<author>
  <name>Philippe Normand</name>
</author>
<id>urn:md5:11329</id>
<generator uri="http://pythonfr.org/">Alinea</generator>



<entry>
<title>phil on Cheetah templates overriding</title>
<author>
<name>phil</name>
</author>
<link rel="alternate" type="text/html" href="http://base-art.net/Comments/159/"/>
<id>http://base-art.net/Comments/159/</id>
<updated>August 12, 2005 12:16 PM</updated>
<content type="html">
&lt;p&gt;Good point Deelan ;)&lt;/p&gt;
&lt;p&gt;Actually the same trick is used by the framework behind this blog, but with #defS instead of #blockS&lt;/p&gt;
&lt;p&gt;See the basic template:&lt;/p&gt;
&lt;p&gt;&lt;a class="reference" href="http://svn.pythonfr.org/public/alinea/Alinea/templates/SitePage.tmpl"&gt;http://svn.pythonfr.org/public/alinea/Alinea/templates/SitePage.tmpl&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And one custom template (the #extends is added a posteriori):&lt;/p&gt;
&lt;p&gt;&lt;a class="reference" href="http://svn.pythonfr.org/public/alinea/Alinea/designs/redFlower/SitePage_c.tmpl"&gt;http://svn.pythonfr.org/public/alinea/Alinea/designs/redFlower/SitePage_c.tmpl&lt;/a&gt;&lt;/p&gt;

</content>
</entry>

<entry>
<title>deelan on Cheetah templates overriding</title>
<author>
<name>deelan</name>
</author>
<link rel="alternate" type="text/html" href="http://base-art.net/Comments/158/"/>
<id>http://base-art.net/Comments/158/</id>
<updated>August 12, 2005 11:27 AM</updated>
<content type="html">
&lt;p&gt;&amp;quot;I don't think that trick will work if you don't compile your templates to Python code.&amp;quot;&lt;/p&gt;
&lt;p&gt;Correct, actually you have to precompile the base class.&lt;/p&gt;
&lt;p&gt;In Subway[1] we managed to automatically compile the whole template hierarchy upon request. Builiding web site using Cheetah and his #extends directive is great. As you have written you can write some default markup into parent template #blockS and then override only when you really need to. No more ugly includes :)&lt;/p&gt;
&lt;p&gt;For example, base site.html:&lt;/p&gt;
&lt;p&gt;&lt;a class="reference" href="http://subway.python-hosting.com/file/sandbox/bikini/view/site.html"&gt;http://subway.python-hosting.com/file/sandbox/bikini/view/site.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;and one view which overrides both &amp;quot;content&amp;quot; and &amp;quot;nav&amp;quot; #blocks:&lt;/p&gt;
&lt;p&gt;&lt;a class="reference" href="http://subway.python-hosting.com/file/sandbox/bikini/view/entry/show.html"&gt;http://subway.python-hosting.com/file/sandbox/bikini/view/entry/show.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;-- deelan&lt;/p&gt;
&lt;p&gt;[1] &lt;a class="reference" href="http://subway.python-hosting.com/"&gt;http://subway.python-hosting.com/&lt;/a&gt;&lt;/p&gt;

</content>
</entry>


</feed>