2 ms·
Technically there's nothing preventing universal server-side templating language (e.g. XSLT & TAL are available for all languages you've mentioned). It's just a
by pornel 16y ago
Technically there's nothing preventing universal server-side templating language (e.g. XSLT & TAL are available for all languages you've mentioned). It's just a matter of everyone agreeing on syntax — and that's the hard part.
- Groxx 16y agoThough we've got nigh-universal bidirectional communication: JSON. That makes JS templating systems server-agnostic, where server-side templates need the server to run more software to render your templates.
- andrewvc 16y agoYou can't just agree on syntax, IMHO the reason for that is the best template languages have the full language available. You need a full-language for a great template language. Smarty, for instance, sucks. HAML, which is terse, but has access to the full syntax of ruby rocks. You can do things like: = @users.map {|u| sprintf("%04d: %s",u.id, u.status.capitalize)}.join(', ') Sure there's some special operator is smarty to do this, but I don't want to have to learn it, and they're always more clunky. Additionally, I always hit complex, weird situations where I need a full-language, and migrating that logic out of the view makes no sense. For instance, I was working on a site where I had repeating content, with ads at predetermined offsets. I rendered it something like: ads_positions = Set.new(2,8,10,12) content.each_with_index do |content,i| if ad_positions.include?(i) content ad else content end end I hate expressing that stuff server-side or in half-baked templating languages.