Templates

Introduction

All of the HTML output generated by AutoGallery SQL is controlled through templates. This gives you a great amount of flexibility when designing your layout and allows you to match AutoGallery SQL to your existing site design. AutoGallery SQL has templates for e-mail messages, the submit form, and of course the TGP pages themselves. For the most part, all of these templates work basically the same. However, there are some differences in each, so there is a section of the manual dedicated to each type of template.
  1. TGP Page Templates
  2. Script Page Templates (submit.cgi, confirm.cgi)
  3. E-mail Message Templates
  4. Language Settings
Before you read each specific section, you should read the general information below. It covers some of the template basics that all templates have in common.

Template Values, Directives, and Control Structures

All of your templates will consist of standard HTML and possibly template values, control structures, and/or directives. The template values will tell AutoGallery SQL what information to display, and the control structures and directives will tell AutoGallery SQL how and what items to place in the template. It is important to understand all of these items before you begin making changes to your templates.

Template Values

In AutoGallery SQL a template value is any string that has two pound sign characters on both sides. For example, ##Date## is a possible template value. When AutoGallery SQL locates a template value in a template, it will try to replace it with an appropriate value. If no appropriate value is found, the template value will be removed and the HTML will be output with nothing in it's place. If an appropriate value is found, AutoGallery SQL will put that value in place of the template value and output the HTML. A quick example should help to clarify this.

Suppose you are working on a template which has two valid template values, ##Date## and ##Time##. You may then have the following HTML code: Since ##Date## and ##Time## are valid template values, AutoGallery SQL will have already calculated the current date and time so they can be placed in the template. When AutoGallery SQL parses the template, it will come across the ##Date## and ##Time## template values. Those two values will be replaced by the date and time that AutoGallery SQL has calculated. Assuming AutoGallery SQL has calculated the date as January 1st, 2003 and the time as 7:00am, AutoGallery SQL would output the following HTML based on your template: Directives

Directives will be used on your TGP page templates to tell AutoGallery SQL how and where to display your galleries. By using a directive you will be able to set several options which will control what galleries are shown, how they are sorted, and the HTML to use for them. The basic directive format is: All directives must be enclosed in <% and %> tags. The <% should appear at the beginning of the line and contain the directive name directly after it with no spaces. The %> tag should appear on a line by itself with no spaces before or after it. There are several keywords you can use in the DIRECTIVE position that will tell AutoGallery SQL what type of directive it is. Each of the directives is described in the TGP Page Templates section of the manual.

Each of the directive options should be on it's own line. The option name should come first, followed by one or more spaces and then the value of the option. The options that are available will depend on the directive you are using. Each option is described in the TGP Page Templates section of the manual.

Control Structures

Control structures will only appear on the Script Page Templates, and you will most likely not need to edit or add your own control structures. Control structures are very similar looking to HTML comments, but there is a specific format you need to follow when using them.

The basic control structure format is: All control structures have a start and end tag, and both must always be used. Failure to use an end tag will result in error messages when displaying the template. The start and end tags of a control structure should always be on a line by themselves with no whitespace before or after the tag.

The Identifier portion of the control structure tells AutoGallery SQL what type of control structure it is, and must always be the first value in a control structure tag.

The Start/End portion of the control structure tag must always come directly after the Identifier. All control structure tags must have a Start and End portion included in the tag.

The Options portion of the control structure tag allows you to specify details about this control structure. The Options value may consist of several words or may only be a single word. In all cases, the Options value should only be included in the Start tag of a control structure. Each type of control structure Identifier has different options, and those will be explained in the sub-sections of this portion of the manual.

Control structures may contain HTML code between their start and end tags. For example: The above code is legal for all control structures. In some cases, you can also nest control structures within each other: This is legal for some control structures but not all. Note that when you are nesting control structures, the End tag for the nested control structure must come before the End tag for the outer control structure. Additionally, all of the HTML for the outer control structure must come before the Start of the nested control structure.