Hacker News new | ask | show | jobs
by krapp 4688 days ago
With templating systems which 'compile' templates down to php anyway, that might be a distinction without a difference.
1 comments

Fair enough. I know Smarty does this and caches the PHP-ized version.

I guess the difference could come from how efficient the template-to-PHP compilation is, but I bet you're right and it's trivial in most cases.

Twig too, and you can sandbox functions and auto-escape data. To me, using templates is more or less the same as using a framework with PHP -- it does add overhead and you could get by with, say, plain PHP and having urls point directly to resources but sometimes I think the benefits of that extra abstraction, even if it is a bit recursive, outweigh the potential costs of not having logical buffers between a request and its execution. An app that's too dumb can come back to bite you just as hard as one that's too clever by half.

Blade (used by Laravel) seems to be more along the lines of "bare PHP/bind to PDO object" but I haven't studied it too hard because i'm such a twig fanboy.