3 ms·
Since PHP is a template language at heart, they go ahead and use PHP. For PHP folk, I guess the question is: how do people handle templating simply in other lan
by Ezku 14y ago
Since PHP is a template language at heart, they go ahead and use PHP. For PHP folk, I guess the question is: how do people handle templating simply in other languages, since they can't use the host language itself for that?
EDIT: Disclaimer: I'm a PHP guy trying to make a break for it, and the question was both rethorical and tongue-in-cheek.
- derpmeister 14y agoI prefer Mustache, but there are plenty of alternatives. http://mustache.github.com/ http://mustache.github.com/
- jackalope 14y agoIn Python, I've always used string substitution. I've never understood the need for a special templating system when it's already built into the language: template = """<boilerplate html>%(greeting)s</boilerplate html>""" parts = {'greeting': "Hello, World!"} page = template % parts I create my site-wide template in a module and never have to look at it again, so my application code is mostly logic. When I have to work on PHP or Coldfusion, I don't understand how people can bear to have the logic hidden in a markup language that's mixed up with another markup language. Many can't, and that's why there are templating engines for what are essentially template-based languages.