我希望能够做一些像这样的事情
// be able to replace this section
Map<String, Object> map = new HashMap<>();
map.put("home.template", "resources"); // foo.html and bar.html (foo invoke bar)
Rythm.init(map);
System.out.println(Rythm.render("foo.html", "World"));
// with this section
Rythm.put("foo.html", fooTemplateStr);//dynamically add/replace foo.html to template repository
Rythm.put("bar.html", barTemplateStr);//dynamically add/replace bar.html to template repository
System.out.println(Rythm.render("foo.html", "World"));我正在构建一个简单的博客引擎,允许用户通过web界面设置/更改模板。但我需要用Rythm将模板固定在目录或jar文件中,我可以动态加载它们吗?
发布于 2016-04-18 07:02:44
在https://github.com/rythmengine/rythmfiddle上查看http://fiddle.rythmengine.org/的源代码。具体而言,请签出以下文件:
https://stackoverflow.com/questions/36682705
复制相似问题