|
Template Files
All template files are stored in the "template" subdirectory of the Discus administration directory. They are found in one of five subdirectories. These subdirectories, in the order that Discus searches them, are as follows:
- custom (customized templates)
- pro (templates specific to Discus Pro)
- admin (administration program)
- ui (user interface)
- mailmesg (e-mail message templates)
All skins are stored in the "skins" subdirectory of the Discus administration directory.
All skins and template files have the extension .tmpl (for template). These are plain text files that must be uploaded in ASCII mode to a server. Templates should be uploaded in ASCII mode, although carriage returns are converted into newlines properly for uploads from Windows and Macintosh platforms.
Parts of a Template
Templates are divided into three portions by special comment tags. The general structure of a template is as follows:
Beginning Section
<!--BEGIN-->
Template Code
<!--END-->
Ending Section
All templates must contain the <!--BEGIN--> and <!--END--> identifiers in order to be recognized as a valid template; otherwise, an error will occur.
All text or code in the "Beginning Section" and "Ending Section" will be ignored, meaning that you may insert any code there that you wish, and this will neither be displayed or interpreted. All code and text you insert must go in the "Template Code" section, i.e., between the <!--BEGIN--> and <!--END--> tags.
The remainder of this documentation will document only that code in this "Template Code" section, as this is the only code that will be displayed, saved to a file, or sent as an e-mail message.
Treatment of Spaces
In general, any leading or trailing spaces are removed, and multiple consecutive spaces are collapsed to a single space. For example, the string " my text here " would be collapsed into "my text here" by the template interpreter. It is possible to force leading, trailing, and multiple consecutive spaces by using certain text operations. However, note that browsers, by default, handle spaces in the same way as the template interpreter. One generally safe way to force spaces is to use for each space that is needed.
When the template language encounters a newline (or carriage return), the template language also starts a new line. It is possible to use newlines within the templates without having a newline appear in the output if the backslash (\) character is placed at the end of a line. Also, it is important to note that because leading and trailing spaces are removed, if a line consists solely of space characters, it will not be output at all.
The following code example illustrates all of these statements regarding the treatment of spaces.
Hello, dear reader!
We are pleased that you\
're interested in the Discus Template Language
Have a great day!
Hello, dear reader!
We are pleased you're interested in the Discus Template Language
Have a great day!
Comments
Adding comments is often helpful for yourself or others who later read your templates. There are two styles of comments that are recognized by the Discus program.
Any line whose first non-space character is a # will be treated as a comment. In other words, lines beginning with # (whether indented or not) are treated as comments and are not displayed or printed.
When the text ## appears in a line, any text after that point will also be treated as a comment.
Literal # characters can be inserted by typing <#>.
Welcome to this example of comments.
# Here is a line that is a comment.
# Indented comments are also comments.
Single # in the middle are not comments.
Double <#><#> are comments! ## Like this
Welcome to this example of comments.
Single # in the middle are not comments.
Double ## are comments!
HTML Comments
Besides the <!--BEGIN--> and <!--END--> comment tags, there is no special treatment for HTML comment tags. HTML comment tags will be sent, as written, directly to the output.
|