4 ms·
Well, the thing is that if your target output isn't HTML, then you wouldn't need to do any DOM manipulation. You'd just output whatever else it is you want to o
by dools 15y ago
Well, the thing is that if your target output isn't HTML, then you wouldn't need to do any DOM manipulation. You'd just output whatever else it is you want to output (JSON, XML, PDF, whatever).
If you had, for example, a bunch of PDF code as a "template PDF" then you might just load that and do string replacement on whatever placeholder text you have in there - but yeah the primary use case I'm thinking of is in implementing web based interfaces.
- einhverfr 15y agoBut then you'd still be back to templating, right? So if you want a consistent interface, templating is pretty clearly the way to go, correct?
- dools 15y agoSorry einhverfr I can't reply to your comment - but what I think you're talking about is trying to abstract display for HTML, PDF, LaTeX, whatever into a common markup language or template, then repurpose that markup for each output format. Does that sound correct? So like, you'd want to be able to have something like: <article> <title><% print article.title %></title> </article> then do something like: $tpl->article = fetchSomeArticleFromTheDb() $tpl->output('template_name',Format::PDF) My argument to that would be that there's no realy need for that abstraction - you don't gain anything by it because you have to have some abstracted output engine that is capable of doing that HTML can already do, which is like, HTML :) Hey, I'd love to continue the discussion, but I think the HN comments are kind of limited in how much they want you to discuss here, feel free to email me iain@workingsoftware.com.au EDIT: oops, code formatting
- einhverfr 15y agoNot really. I will email you though :-) I will probably post something on the selection and design of our templating system for LedgerSMB in my blog too (http://ledgersmbdev.blogspot.com http://ledgersmbdev.blogspot.com) by the end of the week.
- einhverfr 15y agoJust to be clear, I am not entirely hostile to the idea here. I just think that there are plenty of cases where generating high quality printed content or the like doesn't work with it and templating is a lot cleaner in those environments. And when your application already requires templating for a reason like that, adding an entirely different way of handling another output format adds needless complexity. One of the useful applications of dools' ideas is that you could have a mockup which included lorem ipsums or other dummy text. This would make it easier for web developers to test layout. OTOH, as I say, I am not at all convinced that it is a net win for programs that generate multiple formats of output./