Creating templates

From OpenKM Documentation
Revision as of 10:15, 5 April 2011 by Pavila (talk | contribs)

Jump to: navigation, search

As you can see in the User Guide you can create new documents based on templates. But OpenKM offers another feature based in this idea. First of all you need to know the template syntax, which is used by the FreeMarker Template Engine. This engine can be used from making simply variable substitution to loops and other control structure. In this example we use only the basic ones, but you can learn more at FreeMarker Manual.


Nota advertencia.png This section is under construction.

OpenKM can handle 3 types of template documents:

In the three template types we will use this Property Group definition:


PropertyGroups.cnd

<okm = 'http://www.openkm.org/1.0'>
<okg = 'http://www.openkm.org/group/1.0'>
<okp = 'http://www.openkm.org/group/property/1.0'>

[okg:form] mixin
- okp:form.name (string) = '' autocreated
- okp:form.bird_date (string) = '' autocreated
- okp:form.language (string) = '' autocreated

PropertyGroups.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 1.0//EN"
                                 "http://www.openkm.com/dtd/property-groups-1.1.dtd">
<property-groups>
  <property-group label="Sample Form" name="okg:form">
    <input label="Name" name="okp:form.name"/>
    <input label="Bird Date" name="okp:form.bird_date" type="date" />
    <select label="Language" name="okp:form.language" type="simple">
      <option label="Java" value="java"/>
      <option label="Python" value="python"/>
      <option label="PHP" value="php" />
    </select>
  </property-group>
</property-groups>