TGP Page Templates

Introduction

TGP Rotator 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.

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. TGP Rotator 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 TGP Rotator'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 rebuild them. See the Building Pages 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.

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. 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 TGP Rotator what type of directive it is. Each of the directives will be described in detail in this document.

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 this document.

Available Directives

The following section describes all of the template directives (and their options) available to you in TGP Rotator.
Sub-Directives

The GALLERIES directive allows you to include sub-directives so that you can insert HTML in the middle of the section of galleries or change the HTML template so that your galleries are displayed differently. An example of a GALLERIES directive that contains sub-directive is: <%GALLERIES CATEGORY Hardcore SPONSOR Platinum Bucks HTML Thumb SORT Times_Displayed ASC, Weight * RAND() DESC TYPE Text AMOUNT 100 FORMAT Any WEIGHT >= 1.000 HEIGHT Any WIDTH Any REPEATS False SWITCH { LOCATION 50 HTML New_Text } INSERT { LOCATION 3,6,12 HTML </td><td> } %> The SWITCH and INSERT 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

The GALLERIES directive allows you to specify how you want the galleries sorted when they are displayed. TGP Rotator 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. 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.