Live data from Hacker News

PHP's Smarty releases version 3.0

groups.google.com

21–23 of 23 posts

Re: PHP's Smarty releases version 3.0

#21
post #5
post #4

Earlier quoted context omitted.

Among PHP developers, the idea that "PHP is already a templating language" became pretty much memetic. I use an older version of this engine in my work and never really bought into actively hating Smarty, although I stopped using it for my own projects. One of the core arguments against it, I think, was PHP developers suddenly remembering short tags and alternative syntaxes for control structures (if, foreach) that m…

I've always thought that the problem with that viewpoint is that PHP is actually a pretty bad templating language. In Django templates: {{ name }} Things get a bit better if you write your own "h" function: function h($var) { echo htmlentities($var); }

I'm with you there...I like that Smarty covers up some of PHP's quirks, like htmlentities($var) vs urlencode($var) becoming {$var|escape:'html'} and {$var|escape:'url'} respectively.

There are also nice little shortcuts in Smarty, like wrapping templates in {strip}{/strip} to strip newlines and whitespace which would be tricky in PHP without using output buffering.

Re: PHP's Smarty releases version 3.0

#22

I've used smarty (version 3 RC) for a recent project and I have to say I'm very pleased with it. Short tags are bad. They are going to be deprecated in PHP6, and they senselessly take away a little of your application's compatibility across all servers. I don't understand all the hate against Smarty. How would the "PHP is already a templating language" argument explain the rise of all these PHP frameworks we have no,…

Short tags are not going to be deprecated in PHP6, it's been settled long time ago.

http://www.php.net/~derick/meeting-notes.html#remove-support...

Unless you have a more recent source.

Re: PHP's Smarty releases version 3.0

#23
post #7
post #5

Earlier quoted context omitted.

I've always thought that the problem with that viewpoint is that PHP is actually a pretty bad templating language. In Django templates: {{ name }} Things get a bit better if you write your own "h" function: function h($var) { echo htmlentities($var); }

I am not here to defend php (Okay, I guess I am...) but the form is a lot better... We have to have an i18n layer anyway for all output so it ends up being a lot of calls. Use some code gen macros and it's tolerable. Also, XHP seems pretty rad. It gives me ideas. :)

`htmlentities()` defaults to ISO-8859-1 encoding, so the short form is useless in practice, and you need:

    
Post reply on HN