<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Embedding code in web templates doesn&#39;t work well when you have<br>designers on board.<br></blockquote>
<div>&nbsp;</div>
<div>That&#39;s not necesarily true. Templates where there is mostly markup, but let you embed code into them using special tags (ex, &lt;% code %&gt;) are extremely popular and work fairly well. They also keep the template language simple because there is already a full-powered programming language thats embedded into it. Good examples of this method are ERB templates in Rails, JSPs, Perl Mason templates, etc.
</div>
<div>&nbsp;</div>
<div>In these cases one of two things happen: either&nbsp;the designers learn enough of the programming language to embed the right things in, or they just hand off HTML to the developers, who can then replace the dynamic parts with &lt;% %&gt; tags. If I&#39;m a designer and I have learn a new templating language anyway, I may as well just learn a little bit of Haskell/Ruby/Perl/Java/whatever.
</div>
<div>&nbsp;</div>
<div>The best choice of templating technology&nbsp;really depends who the target audience of the web framework is. Has there been much thought given to that yet?</div>
<div>&nbsp;</div>
<div>Maurice</div>
<div><br><br>&nbsp;</div>
<div><span class="gmail_quote">On 4/5/07, <b class="gmail_sendername">Joel Reymont</b> &lt;<a href="mailto:joelr1@gmail.com">joelr1@gmail.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>On Apr 5, 2007, at 2:51 PM, David House wrote:<br><br>&gt; Why add another dependency, force your coders to learn another
<br>&gt; language, restrict yourself to a language which isn&#39;t as expressive as<br>&gt; Haskell, reduce your ability to reuse code from different areas of the<br>&gt; project and decrease project-wide consistency when you could just
<br>&gt; write your templates in Haskell to begin with?<br><br>Embedding code in web templates doesn&#39;t work well when you have<br>designers on board.<br><br>Let me elaborate on my approach as it doesn&#39;t reduce or restrict
<br>anything!<br><br>I&#39;m suggesting that you make your templates look like this, which is<br>parseable as XML. Note the &quot;tal:&quot; tags. Please scroll through to the<br>bottom for more thoughts.<br><br>&lt;?xml version=&quot;
1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;<br>&lt;html&gt;<br>&nbsp;&nbsp;&lt;head&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;title tal:content=&quot;page/title&quot;&gt;Page title&lt;/title&gt;<br>&nbsp;&nbsp;&lt;/head&gt;<br>&nbsp;&nbsp;&lt;body&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;h1 tal:content=&quot;page/title&quot;&gt;Heading&lt;/h1&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hello &lt;b tal:omit-tag=&quot;visitor/humble&quot;&gt;&lt;span<br>tal:replace=&quot;visitor/name&quot;&gt;wo<br>rld&lt;/span&gt;&lt;/b&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/p&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p tal:condition=&quot;msg page/message&quot; tal:content=&quot;msg&quot;&gt;Message&lt;/p&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Hard-coded&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li tal:define=&quot;users page/users&quot; tal:repeat=&quot;item users&quot;<br>tal:content=&quot;ite<br>m/name&quot;&gt;Dummy&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p tal:condition=&quot;page/renderfooter&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Back to<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;a href=&quot;#&quot; tal:define=&quot;up page/up&quot; tal:attributes=&quot;href up/<br>href;title up/<br>title&quot;&gt;index&lt;/a&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/p&gt;<br>&nbsp;&nbsp;&lt;/body&gt;<br>&lt;/html&gt;<br><br>The above expands into this:<br><br>&lt;html&gt;<br>&nbsp;&nbsp;&lt;head&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;Demo page&lt;/title&gt;<br>&nbsp;&nbsp;&lt;/head&gt;<br>&nbsp;&nbsp;&lt;body&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;h1&gt;Demo page&lt;/h1&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hello<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;b&gt;Bruno&lt;/b&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/p&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;(c) 2006&lt;/p&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Hard-coded&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Xavier&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Damien&lt;/li&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Jacques&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Didier&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Jerome&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Back to<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;a title=&quot;Caml Home&quot; href=&quot;<a href="http://caml.inria.fr/">
http://caml.inria.fr/</a>&quot;&gt;index&lt;/a&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/p&gt;<br>&nbsp;&nbsp;&lt;/body&gt;<br>&lt;/html&gt;<br><br>Note how<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Hard-coded&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li tal:define=&quot;users page/users&quot; tal:repeat=&quot;item users&quot;
<br>tal:content=&quot;ite<br>m/name&quot;&gt;Dummy&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br><br>is expanded to<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Hard-coded&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Xavier&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Damien&lt;/li&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Jacques&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Didier&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;Jerome&lt;/li&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br><br>This is nice and _very_ clean and allows you to use any Haskell code<br>you want to _process_ the template. You can, in fact, make template
<br>processing recursive and have tags produce more tags, i.e. make your<br>components produce HTML instead of data for tags in the template.<br><br>What do you think?<br><br>--<br><a href="http://wagerlabs.com/">http://wagerlabs.com/
</a><br><br><br><br><br><br>_______________________________________________<br>web-devel mailing list<br><a href="mailto:web-devel@haskell.org">web-devel@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/web-devel">
http://www.haskell.org/mailman/listinfo/web-devel</a><br></blockquote></div><br><br clear="all"><br>-- <br><a href="http://blog.mauricecodik.com">http://blog.mauricecodik.com</a>