![]() |
![]() |
![]() |
|
![]() |
|||
![]() |
|||
![]() |
GoLive 6 Dynamic Content Samples | ||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
||||||
Main View | Administration View | How it Works | ||||||
![]() |
||||||||
![]() |
|
There is one table, GL_Album_PhotoData, which keeps track of all the information about photos. Custom SQL is used to generate the derived image names for the small, medium, and large images. It also filters the records in the GL_Album_PhotoData table so that it only returns the photos that should be displayed. PhotoDataEach photo has a caption, a date, and a boolean value that indicates whether or not to display it. There is also a unique ID field identifier. GoLive automatically adds references to the ID field whenever a page uses Show Details of Current Record. The Filename field contains a base file name for each photo. The small, medium, and large image files are all derived from this single base name. The Custom SQL QueryThe custom SQL uses computed query fields to generate the file names for the three different images sizes. In this sample the different images sizes are organized into folders, so the small image for 'flower.jpg' is 'images/small/flower.jpg'. The technique of creating computed fields also works if the images are organized by suffix, for example 'images/flower-small.jpg'. The method for creating computed fields is unfortunately different from database to database, so you need to check your database documentation to learn how to create one. Using MySQL, the computed fields have a syntax that looks like this:
If you were using a suffix naming convention, the computed field would look like this:
Note that in the first case Filename already contains the appropriate .gif or .jpg file extension, whereas in the second case it does not. It is possible to create computed fields to implement any kind of naming convention. In addition to generating the derived file names, the query also filters out the photos that should not be displayed. Doing the filtering in the database like this usually leads to simpler designs than the alternative of filtering the records in GoLive. Unfortunately, the syntax for constructing a filtered query is different from database to database, so you need to check your database documentation to learn how to create one. |