Hacker News new | past | comments | ask | show | jobs | submit login

"Smarty released. The best-known templating engine for PHP.

Rasmus realized that he had done something wrong when people started writing template engines for his template engine in his template engine"

:D




Yes. The thing he did wrong IMO was to unleash a scripting language hiding in SGML-ish processing instructions without HTML-aware context-dependent escaping upon the world (when SGML has plenty of rules for delimiter recognition in particular parsing contexts), and then later make up for this with braindead quoting routines (like real_escape_string). In other words, the quick and dirty way was chosen, and that choice has plagued websites in the form of injection attacks (and DDOS using PHP injection attacks targetting even non-PHP sites) to this date.


When the guy who created Smarty (his name escapes me) and announced it on the core PHP developers mailing list, the other developers practically begged him not to release it and told him outright how redundant it was. He did it anyway. PHP may deserve some hate but we shouldn't blame PHP for Smarty existing.


You end doing real, production work on some codebase that uses Smarty. You grasp why. Your next PHP project uses Smarty because you learnt some good things about it. Always balance the pros and cons. Until real world work is done, almost all hate is based on judgement done in blog posts.


I strongly agree Smarty is beyond terrible (and I've used it and read the source code, so I know its problems first hand) and the fact that it even exists is indicitive of deep flaws in PHP, but I don't believe Rasmus has ever realized that he did anything wrong. He just doesn't care.

"We have things like protected properties. We have abstract methods. We have all this stuff that your computer science teacher told you you should be using. I DON'T CARE about this crap at all." -Rasmus Lerdorf

"I'm not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but you're leaking memory everywhere. Perhaps we should fix that. I'll just restart Apache every 10 requests." -Rasmus Lerdorf

https://news.ycombinator.com/item?id=20736574

DonHopkins 9 months ago | parent | favorite | on: YAML: Probably not so great after all

One of the most ridiculous examples of this was the Smarty templating language for PHP. Somebody got the silly idea in their head of implementing a templating language in PHP, even though PHP is ALREADY a templating language. So they took out all the useful features of PHP, then stuck a few of them back in with even goofier inconsistent hard-to-learn syntax, in a way that required a code generation step, and made templates absolutely impossible to debug.

So in the end your template programmers need to know something just as difficult as PHP itself, yet even more esoteric and less well documented, and it doesn't even end up saving PHP programmers any time, either.

https://web.archive.org/web/20100226023855/http://lutt.se/bl...

>Bad things you accomplish when using Smarty:

>Adding a second language to program in, and increasing the complexity. And the language is not well spread at all, allthough it is’nt hard to learn.

>Not really making the code more readable for the designer.

>You include a lot of code which, in my eyes, is just overkill (more code to parse means slower sites).

https://web.archive.org/web/20090227001433/http://www.rantin...

>Most people would argue, that Smarty is a good solution for templating. I really can’t see any valid reasons, that that is so. Specially since “Templating” and “Language” should never be in the same statement. Let alone one word after another. People are telling me, that Smarty is “better for designers, since they don’t need to learn PHP!”. Wait. What? You’re not learning one programming language, but you’re learning some other? What’s the point in that, anyway? Do us all a favour, and just think the next time you issue that statement, okay?

http://www.ianbicking.org/php-ghetto.html

>I think the Broken Windows theory applies here. PHP is such a load of crap, right down to the standard library, that it creates a culture where it's acceptable to write horrible code. The bugs and security holes are so common, it doesn't seem so important to keep everything in order and audited. Fixes get applied wholesale, with monstrosities like magic quotes. It's like a shoot-first-ask-questions-later policing policy -- sure some apps get messed up, but maybe you catch a few attacks in the process. It's what happened when the language designers gave up. Maybe with PHP 5 they are trying to clean up the neighborhood, but that doesn't change the fact when you program in PHP you are programming in a dump.


Why is the use of Blade(Laravel) or Twig(Symfony) any more acceptable than Smarty?


I personally like having the front end templates separated from the server code as much as possible. I think Blade accomplishes this while also providing you with a syntax that is much more readable than Smarty. On top of that I feel like Blade isn't necessarily trying to do as much as Smarty.

EDIT: I certainly prefer using Blade to doing the old '<a href="' . $url . '">... and other similar variants.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: