aptgp III

Installation and Operation Manual

Version 3.0+

 

http://www.apscripts.com/ref/

The most important link in this document is here.  It is the link to the aptgp template language reference.  

 

http://www.apscripts.com/forum/

This is the second most important link.  Here you can post and review questions and comments about using the template system. 

 

 

Installation

 

This script contains a relatively simple directory structure.  To provide compatibility with more systems, the creation of these directories is not handled by the script, but rather, the installer.  It is important to note that aptgp III does not use PHP to display galleries to the end user.  It simply creates static HTML pages.  This is primarily to relieve your server of the load associated with displaying galleries on-the-fly from your database.  If you set aptgp III to build files with the .php extension, you can still include PHP code into your templates.  This is still far more efficient than running your entire TGP on-the-fly.

 

Inside your distribution is a base directory named aptgp-3.x.x.  This directory contains the contents of the two most important directory elements, one of which is:

 

/tgp_data

 

It is highly suggested this directory be placed OUTSIDE of the public root.  This means that no web access is available.  If your host has not provided you with a place for secured files, get a new host.  If you are forced to place this directory in a publically accessible area, at least secure it via .htaccess.

 

Step 1: Edit /tgp_data/aptgp.ini in a text editor.

 

Set the information for access to your database.  If you have not created a database for this application, do so now.  Note the name and access information and edit aptgp.ini accordingly.  You will also need a license key for your domain.  This is available in the online license manager at http://www.apscripts.com/dl/

 

The other two important elements of this file are TGP_DATA and TGP_BUILD.

 

TGP_DATA

This is the physical path to the /tgp_data directory mentioned above.  It should end with a trailing slash.  Note example file contents below.

 

TGP_BUILD

This is where ap|tgp will build and update your TGP.  This directory should contain the contents of this zip in /public_html.  Your public directory does not have to be the root of your domain.  It can be any public sub directory as well.  You might have a warning /index.html, for instance.  If so you might want your TGP to build to yourdomain.com/tgp.  You would now set TGP_BUILD to the physical path on your machine that points to that public sub directory.  If you do not know your physical paths, contact support for assistance.

 

TGP_THUMBS

This is the physical path to the directory in which you will store and access your thumbs.  This should be a publically accessible directory and end in a trailing slash.  This allows you to store all of your thumbs in one central location for your main TGP as well as all satellites.

 

TRADE_SCRIPT

Trade script is simply the URL to your trade script.  Because you will likely be skimming a certain percentage of clicks – you can insert the URL of the gallery into this setting.  The text “[URL]” will be replaced by the scruot with the URL of the gallery, and the click will be passed on to your trade script; i.e. /trade.cgi?url=[URL]&perc=80 depending on the specifics of your trade script.

 

Sample /tgp_data/aptgp.ini settings:

 

LICENSE_KEY = hd98734h9f4ft348djjd8

TGP_DATA = /usr/web/tgp_data/

TGP_BUILD = /usr/web/domain.com/

TGP_THUMBS = /usr/web/domain.com/thumbs/

TRADE_SCRIPT =

DB_SERVER = localhost

DB_NAME = aptgp3

DB_USER = webuser

DB_PASS = g&Y9k7y

ADMIN_ALLOW_PREF_UPDATE = 1

ADMIN_ALLOW_SET_UPDATE = 1

ADMIN_ALLOW_WEBM_DELETE = 1

ADMIN_ALLOW_GAL_DELETE = 1

ADMIN_ALLOW_CAT_DELETE = 1

ADMIN_ALLOW_UPDATE_TEMPLATE = 1

 

Step 2: Upload /tgp_data outside of the public root.

           

Upload the directory and its contents onto your server.  This also includes a sub-directory named /temp.  This sub-directory will store temporary data used by aptgp III.  Note that /tgp_data stores the templates, including the webmaster submission header and footer titled webm_header.html and webm_footer.html.  These can be edited manually.

 

Step 3: Set permissions of /tgp_data and contents to 777.

 

Step 4: Set permissions of /tgp_data/temp to 777.

 

Step 5: Edit/Delete /tgp_data/video.png and /tgp_data/suspended.jpg.

 

A PNG file named video.png is included in the /tgp_data directory.  If this file exists here, it is super-imposed over the gallery preview thumbnail in the lower right hand corner if the gallery has more than 0 videos.  You can create your own image, or delete it.  Any pixel colored R: 204 G: 204 B: 204 or #CCCCCC, will be transparent.  Suspended.jpg will be displayed for a gallery if it is suspended until the suspension is lifted.  This will alert your surfers right away that there is a problem with a gallery and they should not even bother clicking.  To omit this feature, simply delete suspended.jpg.

 

Step 6: Edit /aptgp3/includes/tgp_settings.php.

 

This file stores what PHP calls “Constants.”  This is the top-most level of settings and applies to nearly all functions of  aptgp III.  Here you will set the physical path to aptgp.ini via a constant named INI_PATH.  If you do not know the physical path to aptgp.ini, contact your administrator.

 

You can store aptgp.ini anywhere on your server.  Be warned, this file contains critically secure information about your database.  It is highly recommended that you store this file outside of your public root directory. 

 

Step 7: Upload /aptgp3 into the public root.

 

This includes the following sub-directories:

 

/aptgp3/admin

/aptgp3/includes

/aptgp3/includes/objects

 

Important Note: the files in this directory that end in .php should be uploaded in Binary mode.  The only exception to this is the /aptgp3/includes/tgp_settings.php file.  This should be uploaded in ASCII mode.

 

No permission changes should be necessary with any of these directories or the files therein.  Do not, under any circumstances, edit this directory structure.  The script will malfunction.

 

Your admin password

The admin directory is protected via .htaccess.  You will need to edit this file to reference your tgp.auth file.  A sample path is included to show you where the path should go.  Inside your tgp.auth file will then appear username:password, one per line.  While usernames are stored in plain text, passwords must be encrypted for your safety.  You can encrypt a password at:

 

http://www.earthlink.net/cgi-bin/pwgenerator.pl

 

Example

I want my admin username to be admin and my password to be iud88.  I go to a unix password encrypting tool and type in “iud88” – it responds with rbssbJ7Vp0YaU

 

I place this into my tgp.auth file:

admin:rbssbJ7Vp0YaU

 

Step 8: Build database.

 

Access http://www.yourdomain.com/aptgp3/init_db.php.  Delete init_db.php from your web server.  Your database should be built. 

 

Note: This init_db.php script might error on the first attempt and this is normal.  If so, hit reload and see if the errors clear up.  If not, read ALL the errors.  This script will ALWAYS tell you how to fix the problem.  Some errors can cause other errors.  So follow the advice for all errors displayed and you will be done in no time.

 

Step 9: Upload site directories.

 

If the index page of your domain, as in what people will see when they visit yourdomain.com, is going to be your TGP index, you will be building TGP files to your public root.  If not, you can place the TGP in a sub-directory.

 

Suppose you want your TGP to be located at:

 

http://www.yourdomain.com/tgp/

 

You would upload the following directories into a directory you created named /tgp:

 

/preview

/text

/thumbs

 

Step 10: Set your preferences and settings.

 

While you’re in the Preferences & Settings section of the Admin, now would be a good time to create some categories and review any or all of your 40 settings.

 

Step 11: Edit/Upload templates.

 

HTML Templates belong in the /tgp_data directory.  The template files are:

 

/tgp_data/tpl_index.html

/tgp_data/tpl_preview.html

/tgp_data/tpl_text.html

 

You can edit all templates via the admin under Preferences & Settings.  The email templates are fairly self-explanitory upon carefully reviewing the included examples.  If you edit a template beyond repair, you can always upload over the problem file with the same file from this distribution.

 

 

 

Operation

 

Throughout the Admin are help notes intended to make operation easier for first-time users.  These notes do not go away but may change with updates.  In addition, the preferences that pertain to each section of the admin are displayed in the left-most pane of the admin interface.  A more detailed view of preferences can be found under the Preferences & Settings > Preferences menu.

 

The most significant element of operation is actually editing the templates to suit your needs.  A TGP is a business, and ap|scripts takes TGPs seriously.  As such, the template system included is extremely powerful and will provide your designer(s) with the utmost flexibility in creating a site that is precisely what you want.

 

HTML Templates

 

The HTML templates consist of three elements:

 

Link Definitions

 

A link definition allows you to specify a recurring link tag object.  Suppose you wanted every gallery in a sequence to print out like this:

 

<td>

<a href=”%%tgp_gal_url%%”>%%tgp_gal_title%%</a> -

%%tgp_gal_pics%% pics.

</td>

 

Rather than repeating that throughout your template, with link definitions, you only place that code once in a link definition at the top of your template.  Then, in the HTML of the template you simply write:

 

%%A:feat:pic:today:1%%

%%A:feat:pic:today:2%%

%%A:feat:pic:today:3%%

 

The first element of the link tag in this example is a reference to the Link Definition.  At the top of the template you would place this only once:

 

<?ap LINKDEF A ?>

<td>

<a href=”%%tgp_gal_url%%”>%%tgp_gal_title%%</a> -

%%tgp_gal_pics%% pics.

</td>

<?ap END ?>

 

Link Tags

 

A link tag does a couple of things.  Firstly, as displayed above, it prints out the contents of a link definition.  Secondly, it tells the link definition what to put in place of the Link Definition’s tags.  A chart containing the possibilities of these tags is available online here:

 

http://www.apscripts.com/ref/

 

Inside of your HTML templates, your Link Tags might look something like this:

 

%%A:feat:pic:today:1%%

%%A:feat:pic:today:2%%

%%A:feat:pic:today:3%%

 

The first element of the link tag is the Link Definition.  This tells the system which link definition to use when printing out this link.  The second element is called the Base.  The base is the base group of galleries that will be printed in the sequence.  There are three bases.

 

Pop

Most popularly clicked galleries overall.

 

PopByCat

Most popularly clicked galleries within a category.

           

Feat

Galleries in “Featured” categories.  These normally appear on the front page of a TGP.

 

Cat

Galleries in a specific category.

 

Perm

Any gallery with a weight setting other than 0 is automatically included in the perm object.  If a perm object legitimately gains a position in the most popular table, it is moved out of the perm object and included in the pop object accordinly.

 

Menu

Includes categories for building menus.

 

Ad

For displaying advertisements/paid gallery listings.

 

PageMenu

Prints out page numbers in the category sections or satellites.

 

The second element of the link tag is the Mode.  The mode is the first level of filtering for the base of the tag.  In the Pop, PopByCat, Feat, Cat, and Menu bases, the available modes are:

           

pic

Show galleries without videos only.

 

mov

Show galleries with movies only (a hybrid gallery with pics and movies is a mov gallery)

 

mix

Show galleries with either movies or videos, or both.

 

In the Ad base, there are simply two modes: 1 and 2.  Using a 1 will pull text from Text 1, and 2 from Text 2.

 

The third tag element is the Parameter.  This is the last level of filtering for all link tags.  The parameters are fairly extensive and are most easily viewed on the reference sheet available online at:

 

http://www.apscripts.com/ref/

The most important link in this document is here.  It is the link to the aptgp template language reference.  It practically fits on one screen – but is very powerful.  

 

The fourth and final tag element is the Sequence.  Where you want the first item to be placed, use 1, the second, use 2 and so on.  This applies to all link tags.  A sequence will not properly load without a 1; therefore you cannot start a sequence with 2, etc.

 

Examples

 

%%A:pop:mix:3day:1%%

Using link definition A, load the most popular.  Include a mix of both photo and video galleries based on unique clicks over the last 3days.

 

%%B:feat:pic:today:1%%

Using link definition B, load galleries from featured categories.  Include pics added today.

 

General Tags

 

Some useful general tags available are simple day names.  These are used in the index template of the sample 2 templates.  These match up with the appropriate parameters and can easily be used to pull in an image that says “Wednesday.”  The following day name tags are available:

 

%%dayname_today%%

%%dayname_yesterday%%

%%dayname_day_3%%

%%dayname_day_4%%

%%dayname_day_5%%

%%dayname_day_6%%

%%dayname_day_7%%

 

In addition, each category has general tags as well.  These are useful in your archive, text, and preview templates:

 

%%cat_meta_description%%

%%cat_meta_keywords%%

%%cat_name%%

 

 

 

Email Templates

 

All email templates contain three simple containers for standard email data.  The top of each email template looks like this:

 

<TPL FROMNAME>ThumbThumb</FROMNAME>

<TPL FROMEMAIL>ap@thumbthumb.com</FROMEMAIL>

<TPL SUBJECT>Gallery Approved</SUBJECT>

 

If you accidentally delete this part of the template, you can copy and paste from the manual above.

 

Email: Approval

 

%%gal_title%%

%%gal_url%%

%%comment%%

 

Email: Denial

 

%%gal_title%%

%%gal_url%%

%%comment%%

 

Email: Password

 

%%webm_name%%

%%webm_email%%

%%webm_password%%

 

Email: Confirmation

 

You should include the registration key in a link in the email like this: http://www.yourdomain.com/aptgp3/webm_reg.php?id=%%webm_regkey%%

 

%%webm_name

%%webm_email%%

%%webm_password%%

%%webm_regkey%%