Table of Contents
Introduction

TGPX has a built in feature that will allow you to manage advertisements that can be displayed on your TGP pages. This document will give an overview of how to add, update, and delete advertisements through the control panel interface.

The ad.php script

The ad.php script can be used if you want to track the clicks that your advertisements receive. The first thing you need to do is edit the ad.php script to setup it's variables. Open the ad.php file in a text editor (EditPlus is recommended for Windows users) and locate the $USERNAME variable at the top of the file. You will see something similar to the following: $USERNAME = 'username'; $PASSWORD = 'password'; $DATABASE = 'database'; $HOSTNAME = 'localhost'; These values hold the information for your MySQL database. You should configure these settings so that they point to the same MySQL database that you used when you installed TGPX on your server. Once you have set the variables in the ad.php script, you will need to upload it back to your server, overwriting the default copy of that file. You can also optionally upload the ad.php script to pretty much any directory of your website except the cgi-bin; it does not have to be located in the TGPX installation directory.

Searching Advertisements

To search the current advertisements you have configured so you can modify or delete them, access the Settings > Manage Advertisements function from the control panel menu. This will display a page where you will be able to see and search the current advertisements you have configured. All of the database fields that you can search use the software's Standard Search function with the exception of the Tags field which uses the Boolean Search feature. In the table that displays the advertisements, you will find a couple of functions that you can run on a single advertisement at a time. Those functions are described below. In addition to running functions on single advertisements at a time, you can also delete multiple advertisements at once by putting a check in the box for each advertisement you want to delete and then pressing the Delete button at the bottom of the page.

Adding an Advertisement

To add a new advertisement, access the Settings > Manage Advertisements function from the control panel menu. Near the top of the page in the header bar that reads "Manage Advertisements" click on the icon. This will display a popup window where you will be able to enter the advertisement information that you want to use. Each of the form fields are described below. Once you have filled in all of the fields as you want them, press the Add Advertisement button. This will add the new advertisement to the database.

Advertisement Click Tracking

To have the clicks on your advertisements tracked by TGPX, it is necessary to do a bit of customization to your advertisement HTML code. You should also make sure that the ad.php script has been configured as described at the top of this document.

For an example, assume you have the following HTML code that you want to use for one of your advertisements:
<a href="http://www.jmbsoft.com/r/username/">
<img src="/images/affiliate-banner-general.png" border="0"><br />
Our site uses scripts from JMB Software!
</a>
As you can see, the code simply links directly to http://www.jmbsoft.com/r/username/ which will not track the clicks. You will need to replace that URL with a link to the ad.php script (the script that will track the clicks on your advertisements). The basic format that the ad.php script expects to be called as is: ad.php?id=AD_ID&u=AD_URL Where AD_ID is the ID number assigned to the advertisement by TGPX and AD_URL is the URL to the advertised site. So, for this example you would enter http://www.jmbsoft.com/r/username/ for the Ad URL setting and use the following value for the Ad HTML setting:
<a href="{$config.install_url}/ad.php?id={$ad.ad_id|urlencode}&u={$ad.ad_url|urlencode}">
<img src="/images/affiliate-banner-general.png" border="0"><br />
Our site uses scripts from JMB Software!
</a>
Note that the only thing changed in the HTML code is the link. Instead of linking directly to the site, the link now goes through the ad.php script and passes it both the Ad ID and the Ad URL so it can track the click and forward the surfer to the correct site.

Editing an Advertisement

To edit an advertisement you will first need to locate it through the Manage Advertisements interface. When you locate the advertisement you want to edit, click on the icon to bring up the advertisement editing interface. This interface is nearly identical to the advertisement creation interface, and has the same form fields with the same properties. You can make the changes that you want, and then press the Update Advertisement button to save your changes.

Deleting an Advertisement

To delete an advertisement you will first need to locate it through the Manage advertisements interface. When you locate the advertisement you want to delete, click on the icon, which will ask you to confirm the deletion.

Displaying Advertisments on Your TGP Pages

To display the advertisements you have configured through the control panel interface, you will use the {ad} template function. This template function (as well as all of the other template functions) is described in detail in the TGP Page Templates section of this manual.