Plugin Templates

From Clickframes

Contents

What are Plugin Templates

Plugin templates are Velocity template files. They are mostly plain text files which have dollar sign ('$') placeholder for dynamic variables, for loops and some very basic programming constructs. If you are a developer or UI developer familiar with dynamic placeholders you should have no problem writing velocity files.

Template scopes

Template variables

Template checksum

Checksums are placed in the generated files to enable round trip code generation.

For example, if there is a template with name "${page.id}.html":

 <html>
  <body>
   <h1>${page.title}</h1>
   <p>${page.description}</p>
  </body>
 </html>

The generated file looks like this:

 <html>
  <body>
   <h1>Create An Account</h1>
   <p>This page shows the user an account creation form. Login not required.</p>
  </body>
 </html>
<!-- clickframes::version=939992165::clickframes -->

Notice the checksum section at the end. The html style comment is placed at the end. The HTML style for comment is determined by the extension of the input template.

Custom location for template checksum

By default comments are placed at the end of the generated file. However, you can have the comments placed at alternative location in your output by putting the following snippet somewhere in your template:

clickframes::::clickframes

For example, to get the comments in the body section, you would modify the above template to the following:

 <html>
  <body>
   <h1>${page.title}</h1>
   <p>${page.description}</p>
   <!-- clickframes::::clickframes -->
  </body>
 </html>

The generated file would look like this:

 <html>
  <body>
   <h1>Create An Account</h1>
   <p>This page shows the user an account creation form. Login not required.</p>
   <!-- clickframes::version=939992165::clickframes -->
  </body>
 </html>

This scheme lets you put comments for unsupported file extensions and cases where the comment type is unknown, e.g. a php template where the comment maybe a HTML style comment of a PHP style comment depending on the last line of the file.