Random Galleries From Text Files

Introduction

In addition to the permanent gallery feature, which gives you greater control over randomly placed galleries, you also have the option to display galleries taken from text files. This makes it quick and easy to update a large number of galleries that you want to rotate through your TGP pages. Every time your TGP pages are rebuilt, the random galleries will be rotated.

Creating a File With Galleries

To use this feature you first need to create one or more plain text files that contain your galleries. The text files should contain one gallery per line, with all of the information for the gallery on that line. Each line of the file must follow a specific format so that AutoGallery SQL can determine what information it is getting. The following line is an example of how each line of the file will need to look:

http://www.yoursite.com/gallery.html|http://www.yoursite.com/thumb.jpg|A Description of the gallery|15|Teens|Fred

As you can see, each piece of information about the gallery is separated from the other information by a pipe (|) character. The order in which the information is provided is also important. The fields will need to be in the following order:
  1. Gallery URL
  2. Thumbnail URL
  3. Description
  4. Thumbnails
  5. Category
  6. Submitter Name/Nickname
If you do not want to provide some information, such as a Description, you can leave that field blank. When you do this, you will have two pipe characters next to each other to indicate the empty field:

http://www.yoursite.com/gallery.html|http://www.yoursite.com/thumb.jpg||15|Teens|Fred

Once you have entered all the galleries you want in your text file, you can save it to your hard drive. You can use any filename and any file extension, but I recommend using the .txt file extension so it is recognized more easily as a plain text file.

Uploading The Files

After you have created a text file and saved it to your hard drive, you will need to upload it to your server so AutoGallery SQL can access it. These files should be uploaded to the data/random directory of your AutoGallery SQL installation. Upload the files with your FTP client in ASCII mode. You should not need to change the permissions on the file, but if you get an error when rebuilding your pages you may need to change the permissions to 644.

Setting Up Your Template

The final thing you need to do is setup your template so that AutoGallery SQL knows to display galleries from your text files. You will use the RANDOM directive and sub-directive to display the galleries from these files. More details on these directives can be found in the TGP Page Template section of this manual.

Truly Random Galleries

Note that by using this feature the galleries in your text files will be selected completely at random. There is no way to specify that one gallery should be selected more often and no way to specify that a certain gallery should appear in a certain position. Every time your TGP page is rebuilt AutoGallery SQL will completely randomly select the galleries from the files you specify. If you need greater control over how often and where galleries appear, use the Permanent Gallery feature of the software.