Returns a FreeMarker template from wic_freemarker_templates table and installs a TemplateLoader to allow includes from it.
1 freemarker.template.get
<freemarker.template.get name='name'/>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aname | The name of registered template at the metadata dictionary. |
Returns | |
---|---|
Type | Description |
Object | Returns a FreeMarker template object created with de data getted from the registered template at metadata repository. |
Example
Gets a registered templated and process it. The content of the test.ftl was previously registered at the metadata dictionary.
Copy
<xsql-script name='sample_1'> <body> <![CDATA[ This is the content of the registered template test.ftl. <html> <body> <h3>Template sample</h3> <div style='align:center'>The data of <b>template</b> was getted from the metadata dictionary (table wic_freemarker_templates). The following message shows the text getted from a previous variable. This is done at the <b>template</b> process time. </div> <span> ${message} </span> </body> </html>]]> ]]> <set name='template'> <freemarker.template.get name='test.ftl' /> </set> <set name='message'><string>Hello world! This text is showed in a processed template.</string></set> <println><string.trim> <freemarker.template.process> <template/> </freemarker.template.process> </string.trim></println> </body> </xsql-script>
<html>
<body>
<h3>Template sample</h3>
<div style='align:center'>The data of <b>template</b> was getted from the metadata dictionary (table wic_freemarker_templates).
The following message shows the text getted from a previous variable. This is done at the <b>template</b> process time.
</div>
<span>
Hello world! This text is showed in a processed template.
</span>
</body>
</html>