Re:Your templating engine sucks and everything you've ever w...
by dools on Sunday December 11, 2011 @02:17AM
(#3339533)
Sorry 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 [email protected]
EDIT: oops, code formatting
Re:Your templating engine sucks and everything you've ever w...
by einhverfr on Sunday December 11, 2011 @05:13AM
(#3339773)
Just 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./
Re:Your templating engine sucks and everything you've ever w...
by einhverfr on Sunday December 11, 2011 @02:37AM
(#3339555)
Not 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) by the end of the week.
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.