Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Play Templates Elsewhere

Is it possible to use the templating engine from the Play Framework in other contexts? Ideally I'd like an api of the form:

String result = render("template-file.html",var1,var2);

In some frameworks the templating engine is entirely usable outside of the framework, or even standalone.

like image 487
Richard Warburton Avatar asked Feb 15 '11 00:02

Richard Warburton


1 Answers

I don't know if you can use templating engine outside Play context but you can generate the html page like this :

Map args = new HashMap();
args.put("var1",var1);
...
String html = TemplateLoader.load("contact.html",args).render(); 
like image 172
Ricardo Avatar answered Sep 23 '22 08:09

Ricardo