BBGallery
-- Templates

BBGallery

BB-Zone


All html pages created by BBGallery are derived from a html template.  There are four different page types in each gallery:

Page Type
Template Name
Description
Image pages
image.tmpl
This page displays one image at a time and may have thumbnails and link for/to the previous and next image, as well as links to the index page for this image and a start link for the slideshow.
Index Pages
index.tmpl
Here you see a set of thumbnails linking to the refering image page. A link to the previous and next index may be included as well as a link to the meta index.
Slideshow Pages
slideshow.tmpl
Slideshow pages are just like image pages. The intended use however is to add a meta tag instructing the browser to reload the page after a specified amount of time with the next image.
Meta Index page
meta.tmpl
The meta index is like the index with the difference that the thumbnails don't link to images, but to index pages.


The slideshow and meta-index templates are optional. If you don't use these features you don't need templates for them. In addition to the html template files there may be images and/or style sheets. These will be copied into the gallerie html folder when gallery is created. Each set of files is stored in it's own sudirectory in prefix/lib/bbgalley/templates/name. After installing BBGallery you will find two sets of templates:

/usr/lib/bbgallery/template/monochrome/icon-next.png
/usr/lib/bbgallery/template/monochrome/icon-nextD.png
/usr/lib/bbgallery/template/monochrome/icon-prev.png
/usr/lib/bbgallery/template/monochrome/icon-prevD.png
/usr/lib/bbgallery/template/monochrome/icon-slideshow.png
/usr/lib/bbgallery/template/monochrome/icon-stop.png
/usr/lib/bbgallery/template/monochrome/icon-up.png
/usr/lib/bbgallery/template/monochrome/image.tmpl
/usr/lib/bbgallery/template/monochrome/index.tmpl
/usr/lib/bbgallery/template/monochrome/meta.tmpl
/usr/lib/bbgallery/template/monochrome/newstyle.css
/usr/lib/bbgallery/template/monochrome/slideshow.tmpl

/usr/lib/bbgallery/template/oldstyle/image.tmpl
/usr/lib/bbgallery/template/oldstyle/index.tmpl
/usr/lib/bbgallery/template/oldstyle/meta.tmpl
/usr/lib/bbgallery/template/oldstyle/slideshow.tmpl

The command line option -T name decides which set  is used to greate the gallery pages, where name refers to the directory name in the template folder.

The template files are expanded into html pages using the Perl HTML::Template module, which replaces special tags  in the template with values provided by BBGallery.  To learn about the tags and how o use them read the HTML::Template docs which can be found here. It's an wasy read and explains the templates rather well. Concentrate on the usage examples, all you need to do is to write the actual template files, all the coding has been done for you.

The following variables are available to be used in the refering templates:

Image  and Slideshow  Pages (image.tmpl, slideshow.tmpl)

Variable Name
Function/Value
IMG_CAPTION
Image Caption; This is either the filename (underlines and dashes replaced with spaces unless --raw-caption is used) or the short descrition (first line of description file)
IMG_DSC_SHORT
First line of description file
IMG_DSC
Content of descrition file
NEXT_CAPTION
Caption of next image
NEXT_URL
Link to next image (0 for last image)
NEXT_THUMB_PATH
Thumbnail file for next image
PREV_CAPTION
Caption of previous image
PREV_THUMB_PATH
Thumbnail file for previous image
PREV_URL
Link to previous image (0 for first image)
SLIDESHOW_NEXT
Link to next slideshow page
SLIDESHOW_URL
Link to slideshow page for current image
SLIDESHOW_TIMEOUT
Timeout value for slideshow pages
TITLE
Page title
IMG_URL
Link to image page
IMG_NR
Sequence number of current image
IMG_TOTAL
Total number of images
IMG_SCALED_PATH
Scaled image file
IMG_PATH
Original image file

Index pages (index.tmpl)

Variable Name
Function/Value
NEXT_URL
Link to next index page (0 for last page)
PREV_URL
Link to previous index page (0 for first page)
META_URL
Link to meta index page
INDEX_NR
Sequence number of current index (0 if there is only one index page)
INDEX_TOTAL
Total number of index pages (0 if there is only one index page)
COLUMNS_NR
Number of columns for thumbnails
TITLE
Page title
ROWS
LOOP variable to create rows of image thumbnails
COLUMNS
LOOP variable for thumbnail columns. The following three variables are available for each cell:
IMG_URL
Link to image page
IMG_THUMB_PATH
Thumbnail file for image
IMG_CAPTION
Image caption

Meta Index Page (meta.tmpl)

Variable Name
Function/Value
TITLE
Page title
COLUMNS_NR
Number of columns for thumbnails
ROWS
LOOP variable to create rows of image thumbnails
COLUMNS
LOOP variable for thumbnail columns. The following four variables are available for each cell:
GAL_TITLE
Gallery title
GAL_INDEX
Link to gallery index
GAL_THUMB
Gallery thumbnail file
GAL_COUNT
Number of images in gallery


Please look at the provided templates to see how these variables are used with BBGallery.  The  easiest way to create  a new set of templates is to copy an existing one and incrementally change it until it fits your needs.

If you create a new template and think others may like it as well, please sent me your template along with a short description and I will make it available on this site.

bb-zone.com
This site is Copyright (c) 2003 by Bodo Bauer. Hosting is provided by SourceForge.net.
All trademarks, service marks, and copyrights are property of their respective owners.
SourceForge.net