Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This is probably a holywarish topic, but nevertheless.

In a perfect content management system of your dream, would you rather want a templating system that is completely, 100% separate from your code, and uses declarative syntax to produce (X)HTML (such as <your code> -> DOM/XML -> XSLT -> HTML), or would you rather choose a system that lets your code cook HTML fragments, and then runs some template assembly to put these pieces together to output a complete page?

Thanks in advance.

EDIT

To make it probably a bit more clear, I mean that HTML is a declarative 'language', whereas most of the dynamic stuff is done in imperative/functional languages. Templates glue the two together, but the way they do it isn't always clean (as in clean separation of paradigms).

share|improve this question
    
I already have perfect separation between templating and code. It's not a dream system. It's Django. I don't understand the question. It seems that perfect separation is the way many systems are built. –  S.Lott Feb 15 '11 at 16:52
    
"but the way they [glue HTML declarative and imperative] isn't always clean". What does that mean? Are you complaining about loop and decision constructs in the template language? –  S.Lott Feb 15 '11 at 17:38
    
or am I complaining at all? –  etranger Feb 15 '11 at 17:47
    
@etranger: "isn't always clean"? This is a complaint. If it's not supposed to be a complaint, you need to avoid subjective value judgements like "clean". –  S.Lott Feb 15 '11 at 18:05
    
I disagree, but then again, English is not my native. I was making a statement, if you will. Clean = conforming to paradygm. Anyway, I suggest we leave it as it is, I get your point, thank you. –  etranger Feb 15 '11 at 18:33

2 Answers 2

If the popularity of Ruby on Rails, Django and ASP.NET MVC have taught us anything it is that a clean, MVC-style web framework combined with HTML-like templating that has nearly full language access is the way to go. Can developers make bad decisions about where to put formatting code? Sure. But I'd rather take that risk then deal with the necessary hacks and tricks one needs to do in a system with full separation. Tell me again, how does one format a date in XSLT?

share|improve this answer
    
I see your point, thank you. –  etranger Feb 15 '11 at 17:49

The Xml => XSLT => HTML path is probably overkill. Better just to use a template to output the HTML you need.

share|improve this answer
1  
Overkill as in too complex, too much to learn, too much resource overhead or something else? –  etranger Feb 15 '11 at 17:29
    
My two cents: Too complex, more resource overhead than you need and more of a pain in the ass to maintain than HTML templates. –  5arx Feb 15 '11 at 21:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.