簡體   English   中英

動態加載模板文件到Rythm? (無目錄設置)

[英]Dynamically load template files to Rythm? (without directory setting)

我希望能夠做類似的事情

// 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 文件中,我可以動態加載它們嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM