Difference between revisions of "Creating Text templates"
From OpenKM Documentation
m |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
<source lang="xml"> | <source lang="xml"> | ||
<html> | <html> | ||
− | |||
− | |||
− | |||
<body> | <body> | ||
− | <h1>Sample template | + | <h1>Sample template</h1> |
<table> | <table> | ||
<tr> | <tr> | ||
<td><b>Name</b></td> | <td><b>Name</b></td> | ||
− | <td>${ | + | <td>${okp_tpl_name!}</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><b>Bird Date</b></td> | <td><b>Bird Date</b></td> | ||
− | <td>${ | + | <td>${okp_tpl_bird_date!}</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
<td><b>Language</b></td> | <td><b>Language</b></td> | ||
− | <td>${ | + | <td>${okp_tpl_language!}</td> |
</tr> | </tr> | ||
</table> | </table> | ||
Line 26: | Line 23: | ||
</source> | </source> | ||
− | The tags '''${ | + | The tags '''${okp_tpl_name!}''', '''${okp_tpl_bird_date!}''' and '''${okp_tpl_language!}''' will be replaced by the user input values. An error will occur and abort the template processing if you try to access a missing variable, but the ! operator handles this situation. In addition, you can put a default value in case of a mission one with this expression: |
${missing_value!"The default one"} | ${missing_value!"The default one"} | ||
− | + | The result is a PDF conversion of the HTML template with the client input requested by OpenKM. | |
+ | |||
+ | == Data format == | ||
+ | OpenKM uses FreeMarker inside, so you can take advantage of the FreeMarker formatting flexibilities. For example you can set date format by this way: | ||
+ | |||
+ | ${okp_tpl_bird_date?string("yyyy-MM-dd")} | ||
+ | |||
+ | Learn more about FreeMarker formatting at [http://freemarker.sourceforge.net/docs/ref_builtins.html Built-in Reference]. | ||
[[Category: Installation Guide]] | [[Category: Installation Guide]] | ||
− |
Latest revision as of 11:59, 24 December 2012
For this kind of template will create an HTML one. This is the template source code:
<html>
<body>
<h1>Sample template</h1>
<table>
<tr>
<td><b>Name</b></td>
<td>${okp_tpl_name!}</td>
</tr>
<tr>
<td><b>Bird Date</b></td>
<td>${okp_tpl_bird_date!}</td>
</tr>
<tr>
<td><b>Language</b></td>
<td>${okp_tpl_language!}</td>
</tr>
</table>
</body>
</html>
The tags ${okp_tpl_name!}, ${okp_tpl_bird_date!} and ${okp_tpl_language!} will be replaced by the user input values. An error will occur and abort the template processing if you try to access a missing variable, but the ! operator handles this situation. In addition, you can put a default value in case of a mission one with this expression:
${missing_value!"The default one"}
The result is a PDF conversion of the HTML template with the client input requested by OpenKM.
Data format
OpenKM uses FreeMarker inside, so you can take advantage of the FreeMarker formatting flexibilities. For example you can set date format by this way:
${okp_tpl_bird_date?string("yyyy-MM-dd")}
Learn more about FreeMarker formatting at Built-in Reference.