TGP Page Templates

Introduction

AutoGallery SQL has a powerful template system for setting up your TGP pages. Not only do the templates allow you to specify the design you want for your TGP pages, they also determine how many galleries are displayed on a given page and how the galleries are sorted. Once you have read this document and understand the template system for TGP pages, you should be able to create any type of page layout imaginable.

If you are having problems with your template or are getting a blank page when you rebuild, use our template validator to check your templates for errors

Control Panel Editing Interface

All changes to your TGP page HTML will be made through the control panel. From the control panel menu, locate and click on the Edit Templates link in the TGP Pages section. AutoGallery SQL will load a page where you will be able to select which of your TGP pages you want to edit. Select the page you want to edit from the list, and press the Load HTML button.

You will be returned to the same page, however now there will be a large text input box where you will edit your HTML code. The first time you do this, the text input box will contain AutoGallery SQL's default HTML. You can edit that HTML or paste your own HTML code into this text input box. When you are satisfied with the changes you have made, select the page that you want to save this HTML for and press the Save HTML button. You can save the HTML for multiple pages by selecting all of the pages you want to save it for from the list.

To update your actual TGP pages with the new HTML, you will need to run one of the page building functions. See the Page Building Overview section of the manual for more information on that.

Before Making Changes

Before you start making changes to the default HTML, it is recommended that you look it over and try to understand it. Seeing an example of how the template system works should make it easier for you to create your own templates. It is also recommended that you add a few test galleries to see how they are displayed with the default template.

The software distribution also contains serveral example templates that you can view. They are all located in the examples directory of the software distribution. Each one has a short description telling you how the template works and then will show you the complete template code. You may want to look at some of these examples before you start making changes so you can get some ideas on the template code you might need to use.

Directives

Your TGP page templates have several valid directives that you can use. These are very important, as they determine where your galleries are placed on the page, how they are sorted, and how many are displayed. Each of the directives is described below.

GALLERIES Sub-Directives

The GALLERIES directive allows you to include sub-directives so that you can insert galleries and other HTML in the middle of the section of galleries. An example of a GALLERIES directive that contains sub-directive is:
<%GALLERIES
TYPE Submitted
CATEGORY Mixed
AMOUNT 100
ORDER Build_Counter
HTML Text

SWITCH
{
    LOCATION 50
    HTML New Text
}

GALLERIES
{
    LOCATION +5
    TYPE Permanent
    HTML Text
    CATEGORY Mixed
    ORDER RAND() * Weight DESC
}

RANDOM
{
    LOCATION +10
    HTML Text
    FILE random.txt
}

INSERT
{
    LOCATION 3,6,12
    HTML </td><td>
}
%>
The SWITCH, INSERT, RANDOM and GALLERIES values are the sub-directives. Note that the options for the sub-directives are enclosed in curly braces; this must always be done. In this example, the options for the sub-directives have been indented. This is not required, but does make them easier to locate and read.

Sorting in GALLERIES sections

The GALLERIES directive allows you to specify how you want the galleries sorted when they are displayed by using the ORDER and REORDER options. AutoGallery SQL offers you several options for sorting your galleries. Each of the options is listed below. All of these values can be modified with DESC to sort in descending order instead of ascending order. Additionally, these values may be combined together to generate sub-sorting options. We'll give a few examples of what will probably be commonly used sorting options. Sorting in CATEGORIES sections

The CATEGORIES directive allows you to specify how you want the galleries sorted when they are displayed by using the ORDER option. Each of the options is listed below. All of these values can be modified with DESC to sort in descending order instead of ascending order. Additionally, these values may be combined together to generate sub-sorting options. We'll give a few examples of what will probably be commonly used sorting options. Template Values

Your TGP pages have many template values available. Some can be used anywhere on the page, and some can only be used in the HTML option of certain directives. All of the available template values and the locations where they can be used are described below.