I have custom Rythm template tag (sayHi.html) which I want to call from parent template (index.html):
In sayHi.html:
Hi there!
In index.html:
<html>
<head></head>
<body>@sayHi()</body>
</html>
I have found out that default behaviour of Rythm template engine (v0.9) is that it tries to find custom template file in current application folder. Thus if I have web project running in Tomcat the path would be /TOMCAT_HOME/bin/sayHi.html
How could I tell Rythm to load custom tags from another path (eg /WEB-INF/tags)?
you can ask Rythm
to load tags from anywhere:
Rythm.engine.loadTags(new File("/WEB-INF/tags"));
See source code here
You can also init Rythm.engine
(or RythmEngine
instance managed by yourself):
Properties conf = new Properties();
conf.put("rythm.tag.root", "/WEB-INF/tags");
Rythm.engine.init(properties); // use Rythm managed engine instance
myEngine = new RythmEngine(conf); // manage rythm engine instance by yourself
Note
Updates
Rythm has deprecated the tag concept, as now you can call any template as a "tag". See http://rythmengine.org/doc/template_guide.md#invoke_template
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.