Like creating new Template via user Interface its possible to create new Template by writing definition.xml file command/tag that instruct CJT to create new Template.

Templates must be defined first before Blocks. Linking Block to Templates is not being created yet would cause the package installer to fail.

Creating Template can be done by using <object> tag. object tag with Type=’template’. It would instruct CJT to create new Template by using the fields laying between <object></object> tags.

<object type="template">
  TEMPLATE FIELDS GOES HERE...
  .....
  .....
  .....
</object>

Basic Template Data

Template Data is what defining the Template, the basic Data Field is currently name, type, description and code. They can defined as following:

<object type="block">
  <name>TEMPLATE-NAME</name>
  <description></description>
  <type>TEMPLATE_TYPE</type>
  <code>[RAWDATA] or [CODEFILE]</code>
</object>

Code data can be raw or point to file. Raw data must be presented inside CDATA section as following. Please note that name is very important as its what is used to link Template to Blocks.

Template type can be either html, javascript, css or php however if not specified and a code is pointing to a file it would obtain the type from the code file extension, if no code file or a type defined it would be a css by default. So be careful when defining the type.

<code><![CDATA[RAW-CODE]]></code>

In many situation specially when Block Code is huge, its better to add Block Code in external file as following

<code locate='file'>CODE-FILE</code>