<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP as a template language</title>
	<atom:link href="http://www.jansch.nl/2010/02/11/php-as-a-template-language/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-as-a-template-language</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Wed, 03 Aug 2011 06:49:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Tomasz Jędrzejewski</title>
		<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/#comment-1539</link>
		<dc:creator>Tomasz Jędrzejewski</dc:creator>
		<pubDate>Wed, 03 Nov 2010 06:44:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansch.nl/?p=2441#comment-1539</guid>
		<description>In my opinion, if we decide to use other-than-PHP template language, we should choose something that really helps, not just replaces  to { ... } like Smarty does. Such template engines not only don&#039;t solve any problems, but also introduce new ones by their esoteric syntax and limitations. I.e Smarty 2 could not execute normal expressions in normal way, but forced to use some weird replacements like {math} instruction or &quot;modifiers&quot;, not mentioning complete lack of tools for making modular templates. These drawbacks are fixed &quot;now&quot;, in Smarty 3, 5 years after other template engines noticed the need to introduce such things!

Some logic is always necessary in templates, it cannot be fully separated, unless we want to have 19281 templates for the same page, for every possible case. The point is to understand what is a presentation logic and what is business logic. The first one in templates is OK, second one - not. Template engines should ease writing presentation logic by introducing specialized instructions etc. not just give loops, ifs and that&#039;s all. Good examples that there is another way are PHPTAL and more advanced Open Power Template 2. Both of them use XML templates, validate template syntax on the fly, and provide some high-level abstractions to the ordinary control programming structures which simplifies writing templates. In OPT, the template is even separated from the real nature of data passed from PHP to it, i.e. you do not have to worry if this is an array, object or something else, and if it is a loop, how the sub-rows are actually represented. In pure PHP and Smarty this is hardly possible.</description>
		<content:encoded><![CDATA[<p>In my opinion, if we decide to use other-than-PHP template language, we should choose something that really helps, not just replaces  to { &#8230; } like Smarty does. Such template engines not only don&#8217;t solve any problems, but also introduce new ones by their esoteric syntax and limitations. I.e Smarty 2 could not execute normal expressions in normal way, but forced to use some weird replacements like {math} instruction or &#8220;modifiers&#8221;, not mentioning complete lack of tools for making modular templates. These drawbacks are fixed &#8220;now&#8221;, in Smarty 3, 5 years after other template engines noticed the need to introduce such things!</p>
<p>Some logic is always necessary in templates, it cannot be fully separated, unless we want to have 19281 templates for the same page, for every possible case. The point is to understand what is a presentation logic and what is business logic. The first one in templates is OK, second one &#8211; not. Template engines should ease writing presentation logic by introducing specialized instructions etc. not just give loops, ifs and that&#8217;s all. Good examples that there is another way are PHPTAL and more advanced Open Power Template 2. Both of them use XML templates, validate template syntax on the fly, and provide some high-level abstractions to the ordinary control programming structures which simplifies writing templates. In OPT, the template is even separated from the real nature of data passed from PHP to it, i.e. you do not have to worry if this is an array, object or something else, and if it is a loop, how the sub-rows are actually represented. In pure PHP and Smarty this is hardly possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Faltzer</title>
		<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/#comment-1538</link>
		<dc:creator>Faltzer</dc:creator>
		<pubDate>Fri, 30 Jul 2010 17:51:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansch.nl/?p=2441#comment-1538</guid>
		<description>Smarty is terrible; any templating engine that effectively evaluates PHP code is bad anyway.  Hence why SUIT is better suited for the purpose of templating, because there is true separation of logic involved, and far less chance of security being compromised should an attacker gain access to your templates.</description>
		<content:encoded><![CDATA[<p>Smarty is terrible; any templating engine that effectively evaluates PHP code is bad anyway.  Hence why SUIT is better suited for the purpose of templating, because there is true separation of logic involved, and far less chance of security being compromised should an attacker gain access to your templates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fedor</title>
		<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/#comment-1537</link>
		<dc:creator>Fedor</dc:creator>
		<pubDate>Sun, 11 Apr 2010 16:27:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansch.nl/?p=2441#comment-1537</guid>
		<description>Smarty sucks!!! So much code for so little.</description>
		<content:encoded><![CDATA[<p>Smarty sucks!!! So much code for so little.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hirvine</title>
		<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/#comment-1536</link>
		<dc:creator>Hirvine</dc:creator>
		<pubDate>Mon, 15 Feb 2010 14:57:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansch.nl/?p=2441#comment-1536</guid>
		<description>ah form removed my php tags completely, but you get the idea I think :)</description>
		<content:encoded><![CDATA[<p>ah form removed my php tags completely, but you get the idea I think <img src='http://www.jansch.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hirvine</title>
		<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/#comment-1535</link>
		<dc:creator>Hirvine</dc:creator>
		<pubDate>Mon, 15 Feb 2010 14:55:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansch.nl/?p=2441#comment-1535</guid>
		<description>True, about messed up PHP, but your example actually shows a poor controller.
A controller shouldn&#039;t use the same view for an error and valid xml.
On the other hand, if I don&#039;t retain the `error` message idea, you may tell blank error message is no error. Which would preserve a single view. Short-tags is indeed irritating here. Mine would look like.

Valid 


&lt;result processed=&quot;processed? &#039;yes&#039;:&#039;no&#039;; ?&gt;&quot;
       &lt;orderId=&quot;orderid; ?&gt;&quot; /&gt;


Error


&lt;result processed=&quot;processed? &#039;yes&#039;:&#039;no&#039;; ?&gt;&quot;
     &lt;orderId=&quot;orderid; ?&gt;&quot; /&gt;
     &lt;error message=&quot;error; ?&gt;&quot; /&gt;


It also fixes your missing &#039;&lt;&#039; in front of the order id element.
You have also missed the self closing slash on order id element.

Clearly Smarty didn&#039;t helped you to find those format errors. So no &quot;Easy to Use and Maintain&quot; story for Smarty.


Hey don&#039;t get me wrong. It is what  @Manes tells. Using smarty is depended by situation and business. Among friends PHP would do the trick, among a big business which uses different frameworks/cms you may think using template systems.</description>
		<content:encoded><![CDATA[<p>True, about messed up PHP, but your example actually shows a poor controller.<br />
A controller shouldn&#8217;t use the same view for an error and valid xml.<br />
On the other hand, if I don&#8217;t retain the `error` message idea, you may tell blank error message is no error. Which would preserve a single view. Short-tags is indeed irritating here. Mine would look like.</p>
<p>Valid </p>
<p>&lt;result processed=&#8221;processed? &#8216;yes&#8217;:'no&#8217;; ?&gt;&#8221;<br />
       &lt;orderId=&#8221;orderid; ?&gt;&#8221; /&gt;</p>
<p>Error</p>
<p>&lt;result processed=&#8221;processed? &#8216;yes&#8217;:'no&#8217;; ?&gt;&#8221;<br />
     &lt;orderId=&#8221;orderid; ?&gt;&#8221; /&gt;<br />
     &lt;error message=&#8221;error; ?&gt;&#8221; /&gt;</p>
<p>It also fixes your missing &#8216;&lt;&#8217; in front of the order id element.<br />
You have also missed the self closing slash on order id element.</p>
<p>Clearly Smarty didn&#8217;t helped you to find those format errors. So no &#8220;Easy to Use and Maintain&#8221; story for Smarty.</p>
<p>Hey don&#8217;t get me wrong. It is what  @Manes tells. Using smarty is depended by situation and business. Among friends PHP would do the trick, among a big business which uses different frameworks/cms you may think using template systems.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PHP as a template language &#171; Aljo Guts</title>
		<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/#comment-1534</link>
		<dc:creator>PHP as a template language &#171; Aljo Guts</dc:creator>
		<pubDate>Mon, 15 Feb 2010 14:40:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansch.nl/?p=2441#comment-1534</guid>
		<description>[...] Latest news)  One of the great debates in the world of PHP &#8211; is the language by itself a good templating language (versus using something like Smarty)? I think I&#8217;ve said it before. The tool you use should [...] </description>
		<content:encoded><![CDATA[<p>[...] Latest news)  One of the great debates in the world of PHP &#8211; is the language by itself a good templating language (versus using something like Smarty)? I think I&#8217;ve said it before. The tool you use should [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 網站製作學習誌 &#187; [Web] 連結分享</title>
		<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/#comment-1533</link>
		<dc:creator>網站製作學習誌 &#187; [Web] 連結分享</dc:creator>
		<pubDate>Sat, 13 Feb 2010 14:16:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansch.nl/?p=2441#comment-1533</guid>
		<description>[...] PHP as a template language [...] </description>
		<content:encoded><![CDATA[<p>[...] PHP as a template language [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manes</title>
		<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/#comment-1532</link>
		<dc:creator>Manes</dc:creator>
		<pubDate>Sat, 13 Feb 2010 12:24:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansch.nl/?p=2441#comment-1532</guid>
		<description>I agree with the point that the adoption of a technology depends on the business requirements: if you think Smarty is the right tool for the job when why not use it?
Nevertheless, I don&#039;t see why a developer shouldn&#039;t look at the disadvantages of using such tool. I have never come across a website about any piece of software that lists its disadvantages and I am not surprised. I mean, why would you want to list the disadvantages of the product you&#039;ve been working on? You don&#039;t need a degree in marketing to answer this question.
Perhaps some really frustrated developer took the trouble to create nosmarty.net, maybe when he chose Smarty as the templating engine to use in production he had only looked at the advantages of it, whereas back then he needed to look at the bigger picture and maybe today he would have been a lot happier had he not chosen Smarty.
I have used Smarty in the past and I personally think it&#039;s not bad, it did the job back then, but I wouldn&#039;t use it again today, I&#039;m looking at alternatives such as PHPTAL: the logic is tightly integrated with the markup thus forcing you to write clean XHTML. Isn&#039;t that better? Plus, I saw Smarty code producing JavaScript code, XML feeds, documents later converted into PDFs. I know I am repeating myself, but when we all say we should use the right tool for the job, then why use Smarty to produce JavaScript code, XML feeds, documents? Any JavaScript library (Prototype, jQuery, etc.), the DOM extension and the PDF extension all seem to be better tools for the aforementioned examples.
This is my humble opinion, feel free to disagree.</description>
		<content:encoded><![CDATA[<p>I agree with the point that the adoption of a technology depends on the business requirements: if you think Smarty is the right tool for the job when why not use it?<br />
Nevertheless, I don&#8217;t see why a developer shouldn&#8217;t look at the disadvantages of using such tool. I have never come across a website about any piece of software that lists its disadvantages and I am not surprised. I mean, why would you want to list the disadvantages of the product you&#8217;ve been working on? You don&#8217;t need a degree in marketing to answer this question.<br />
Perhaps some really frustrated developer took the trouble to create nosmarty.net, maybe when he chose Smarty as the templating engine to use in production he had only looked at the advantages of it, whereas back then he needed to look at the bigger picture and maybe today he would have been a lot happier had he not chosen Smarty.<br />
I have used Smarty in the past and I personally think it&#8217;s not bad, it did the job back then, but I wouldn&#8217;t use it again today, I&#8217;m looking at alternatives such as PHPTAL: the logic is tightly integrated with the markup thus forcing you to write clean XHTML. Isn&#8217;t that better? Plus, I saw Smarty code producing JavaScript code, XML feeds, documents later converted into PDFs. I know I am repeating myself, but when we all say we should use the right tool for the job, then why use Smarty to produce JavaScript code, XML feeds, documents? Any JavaScript library (Prototype, jQuery, etc.), the DOM extension and the PDF extension all seem to be better tools for the aforementioned examples.<br />
This is my humble opinion, feel free to disagree.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sugar Developer Blog &#187; Blog Archive &#187; Smarty or PHP as a templating language?</title>
		<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/#comment-1531</link>
		<dc:creator>Sugar Developer Blog &#187; Blog Archive &#187; Smarty or PHP as a templating language?</dc:creator>
		<pubDate>Fri, 12 Feb 2010 20:49:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansch.nl/?p=2441#comment-1531</guid>
		<description>[...] came across an interesting post by Ibuildings CTO Ivo Jansch, talking about the use of Smarty as a templating language over PHP [...] </description>
		<content:encoded><![CDATA[<p>[...] came across an interesting post by Ibuildings CTO Ivo Jansch, talking about the use of Smarty as a templating language over PHP [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: drm / Gerard</title>
		<link>http://www.jansch.nl/2010/02/11/php-as-a-template-language/#comment-1530</link>
		<dc:creator>drm / Gerard</dc:creator>
		<pubDate>Fri, 12 Feb 2010 16:32:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansch.nl/?p=2441#comment-1530</guid>
		<description>Wow, this template discussion might surpass HipHop in the topic-of-the-month award in the PHP community ....

Ivo, I wholeheartedly agree with your post. When I saw the replies on my own blogpost about Twig, I started pondering about starting a site &quot;nonosmarty.net&quot;,  which would explain why *every* *single* point displayed on nosmarty.net is either biased or off topic. You point it out well: it is not about whether PHP as a template engine is wrong, it is about why another template engine would be a better fit for your needs. Emphasis is on &quot;FIT&quot;, not on &quot;BETTER&quot;.</description>
		<content:encoded><![CDATA[<p>Wow, this template discussion might surpass HipHop in the topic-of-the-month award in the PHP community &#8230;.</p>
<p>Ivo, I wholeheartedly agree with your post. When I saw the replies on my own blogpost about Twig, I started pondering about starting a site &#8220;nonosmarty.net&#8221;,  which would explain why *every* *single* point displayed on nosmarty.net is either biased or off topic. You point it out well: it is not about whether PHP as a template engine is wrong, it is about why another template engine would be a better fit for your needs. Emphasis is on &#8220;FIT&#8221;, not on &#8220;BETTER&#8221;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

