Template Examples

Introduction

This document will provide several partial template examples of what you might use on your TGP page templates and will explain in detail how each example works. It is important that you understand how the page building process works, so it is recommended that you read the Page Building Overview section of the software manual first. The software distribution also includes a few complete example templates which can be found in the examples directory.

The Examples

For each of the examples, the template code will be shown first followed by a detailed description of how that section works.

<%GALLERIES
AMOUNT 20
TYPE Text
HTML <a href="##Gallery_URL##" target="_blank">##Description##</a><br />
DESCRIPTION True
ORDER RAND()
STATUS Used
%>

To get started, this is a fairly simple example. This example will show 20 galleries using the template defined in the HTML option. Each of the specified options is explained below.

<%GALLERIES
AMOUNT 10
TYPE Text
HTML <a href="##Gallery_URL##" target="_blank">##Description##</a><br />
DESCRIPTION True
ORDER Times_Selected, RAND()
REORDER RAND()
STATUS Pending
%>

<%GALLERIES
AMOUNT 10
TYPE Text
HTML <a href="##Gallery_URL##" target="_blank">##Description##</a><br />
DESCRIPTION True
ORDER RAND()
STATUS Used
%>
This example is very similar to the first one, however in this case there are two GALLERIES sections. The second GALLERIES section functions identically to the previous example, but it only shows 10 galleries. The first GALLERIES section is different because the STATUS option is set to Pending and it is using both the ORDER and REORDER options. Each of the changed and new options is described below.

<table>
<tr>
<%GALLERIES
AMOUNT 20
TYPE Thumb
HTML <td><a href="##Gallery_URL##" target="_blank"><img src="##Thumbnail_URL##" border="0"></a></td>
ORDER (Clicks/Build_Counter) DESC
STATUS Used
MAXAGE 7
GLOBALDUPES True

INSERT
{
    LOCATION +5
    HTML </tr><tr>
}
%>
</tr>
</table>
This example shows how to create a basic hall of fame section. In this section there will be 20 thumbnails, with 5 per row. The galleries will be displayed in order from most productive to least productive. The INSERT sub-directive inserts the necessary HTML code after every 5th thumbnail so that a new row will be started. Each of the options is described below.

<table>
<tr>
<%GALLERIES
AMOUNT 5
TYPE Thumb
HTML <td><a href="##Gallery_URL##" target="_blank"><img src="##Thumbnail_URL##" border="0"></a></td>
ORDER (Clicks/Build_Counter) DESC
STATUS Used
AGE 1
GLOBALDUPES True
%>
</tr>
<tr>
<%GALLERIES
AMOUNT 5
TYPE Thumb
HTML <td><a href="##Gallery_URL##" target="_blank"><img src="##Thumbnail_URL##" border="0"></a></td>
ORDER (Clicks/Build_Counter) DESC
STATUS Used
AGE 2
GLOBALDUPES True
%>
</tr>
<tr>
<%GALLERIES
AMOUNT 5
TYPE Thumb
HTML <td><a href="##Gallery_URL##" target="_blank"><img src="##Thumbnail_URL##" border="0"></a></td>
ORDER (Clicks/Build_Counter) DESC
STATUS Used
AGE 3
GLOBALDUPES True
%>
</tr>
</table>
This example is also a hall of fame section, but it works a little bit different than the basic one in the previous example. In this case there are three separate GALLERIES sections. Each one displays one row of galleries, with 5 galleries in each. The other difference is that the MAXAGE option is replaced with the AGE option and in each of the individual GALLERIES sections the AGE value is set differently. The first section displays the most productive galleries from yesterday, the second section displays the most productive galleries from 2 days ago, and the third section displays the most productive galleries from 3 days ago.

<table>
<tr>
<%GALLERIES
AMOUNT 1
TYPE Thumb
HTML <td><a href="##Gallery_URL##" target="_blank"><img src="##Thumbnail_URL##" border="0"></a></td>
STATUS Pending
ORDER Times_Selected, RAND()
REORDER Build_Counter
%>
<%GALLERIES
AMOUNT 19
TYPE Thumb
HTML <td><a href="##Gallery_URL##" target="_blank"><img src="##Thumbnail_URL##" border="0"></a></td>
STATUS Used
ORDER Build_Counter

INSERT
{
    LOCATION 4,9,14
    HTML </tr><tr>
}
%>
</tr>
</table>
This example shows how to create a table of thumbnails where one new thumbnail is added in the first position each time you run a "Build With New" type build. The first GALLERIES section is setup to display only one thumbnail; that is the position where the new thumbnail will be added. The second GALLERIES section will show the previously selected new galleries in the order they were selected. So, if you run a "Build With New" type build, one new gallery will move into the first position, and the gallery that was previously in that position will move over one. This will force all of the other galleries to also move one position until they are eventually pushed out of the table. They key to this is the ORDER option which is set to Build_Counter. The build counter is incremented every time a page build is executed, so that is how the galleries know to move one slot over every time a "Build With New" type build is excuted. During a normal "Build" the galleries will not move (unless there are other factors that would cause them to be selected in another GALLERIES section, for example if a gallery got a large number of clicks it may move into a hall of fame section).