Customizing Templates

Job Manager makes it easy for users to configure their templates to suit the look and feel of any website.

All the templates used by Job Manager can be found in the /templates/ directory. These files aren't displayed directly on your site but rather are used as templates to "publish" additional files that are. When editing these template files, we recommend you use a text based HTML editor. The templates use special tags to define and insert information and using WYSIWYG HTML editors can be problematic.

If you must use a WYSIWYG, keep a copy of the original template, make your modifications, then go through both files in a text editor to make sure that all the special template tags and placeholders are in their proper spots. Try making a very simple change first off to see if you can use the WYSIWYG.

Each template has a number of variables or "placeholders" that can be inserted to tell the program what information to insert in the published page. A placeholder usually looks like a word or series or letters and numbers surrounded by two dollar signs. Another way that placeholders can be written is by using a special tag so the actual placeholder isn't visible when viewing the template itself though a web browser. When published, both will look exactly the same.

$name$
  or
<!-- template insert : $name$ -->

In addition, some templates use TemplateCells. A TemplateCell is a block of HTML that can be displayed, not displayed, or displayed multiple times. When the program parses your templates, TemplateCells are removed from the rest of the page, then used to create placeholders. An example of TemplateCells is shown below.

<ul>
<!-- template insert : $list$ -->
<!-- templatecell : row -->
<li> Found the following item: $name$
<!-- /templatecell : row -->
<!-- templatecell : notfound -->
<li> Sorry, no items were found!
<!-- /templatecell : notfound -->
</ul>

The program reads in the TemplateCells first, removing them from the rest of the document as it goes. If you were to view the template in a web browser, you would see both "Found the following item: $name$" and "Sorry, no items were found!" However, when the program publishes this page, it will either have a list of items, or it will display the apology, not both.

Assuming that there are items to be displayed, the "row" cell will be duplicated for each, and the placeholder $name$ will be subbed in. If there are no items to be shown, the program will use the "notfound" cell. The end result will be subbed into the $list$ placeholder in the main part of the document.

<ul>
<li> Found the following item: Apple
<li> Found the following item: Orange
<li> Found the following item: Pear
</ul>


Note that you cannot change the names of placeholders or TemplateCells, these names and their special tags must be reproduced precisely for the program to understand your templates.

You can add or remove as many valid placeholders as you wish from the templates, invalid placeholders will be ignored and removed when published. Adding or removing TemplateCells will cause the program to display an error.



Some suggestions for customizing templates:

1. Keep backups of the original templates handy. You can refer to them for reference.

2. Save and test frequently. Often a TemplateCell will be corrupted early on, and won't be caught until after major modifications have been done. It may be very difficult to find the problem if you don't have a similar working copy to refer to.

3. When customizing a live program, copy the program elsewhere on your server and modify the templates there. By working on templates that are not live you avoid the risk of having customers encounter any potential mistakes.