There is TemplateLoader in Play 1.0 for generating templates in runtime.
Is there any solution to dynamically load template in Play 2.0? Or can I somehow convert it to scala code for using Eval?
For example: I want to store some templates in the database, so that certain users could edit them.
It seems the relevant code is in
framework/src/play/src/main/scala/system/ApplicationProvider.scalain the Play-2.0 directory, particularly theReloadableApplicationclass. I’m unsure how this compiling on the fly would suit you, since you don’t want to do it when the template is requested (it is slow). Which means that storing in a database doesn’t quite make sense: you don’t want to store the template source code, but rather the compiled template object.For arguments sake, if you just wrote the templates to the
app/viewsdirectory, you could leave Play to compile them at its leisure. But then, beware, because they probably won’t compile on a production system.