GenPics add-in to pphtml | |||||||
|
|||||||
GENPICS: A PPHTML PREPROCESSOR ADD-INgenpics is a built-in feature of the pphtml preprocessor, that generates web page picture galleries
as simple html tables. The output is one 'gallery' page, and one 'picture' page per picture.
The intent is to be low-tech, and create galleries that will display on almost any type of browser. genpics does not exactly create picture galleries directly. What it does instead is drive the pphtml preprocessor, by setting several macro ('#define') variables, then apply them to a template that you provide. It does this one time for each 'picture' line in the configuration text file. The genpics add-in does not really know anything about pictures, although it does do a resolution calculation, so that if you supply the actual resolution of the picture, it will set the variables for the correct aspect ratio when scaled in size. But all the rest is done via templates, so that it makes very few assumptions about what is being created, or how it will be used. To create a gallery, you create a gallery page containing an empty pair of table tags where the picture thumbnails will be inserted. In place of the code for the thumbnails, you insert a call to function %GENERATE_PIC_ROWS%(). It treats your page as a template, and generates a second page with the html for the pictures inserted in the table. For example, the following template will generate a table of picture thumbnails with a maximum of 6 pictures per row:
<table class="pic_table"> To know what code to place inside of the table, %GENERATE_PIC_ROWS%() needs to have three things defined:
These are defined using three separate #defines, which must appear before the call to %GENERATE_PIC_ROWS%(). For example:
#define_block %PIC_ROW_OPEN% You then invoke pphtml, passing a configuration file that lists the picture files, and optional picture titles.
Utah Pictures 752 500 The %GENERATE_PIC_ROWS%() macro expands inside of the table tags, defined by the macros above. It actually does not really know it is creating an HTML table, and in fact could be used to generate many other types of display formats. The generated code derives from the macros above, with the macro variables (enclosed in '%' characters) replaced with values generated
from the configuration file.
<table class="pic_table"> How it works:Macro %GENERATE_PIC_ROWS%() reads the configuration file.
For each line in the file, it sets its macro variables (e.g. %PICNUM_HTML%), then inserts a copy
of the contents of macro %PIC_ITEM%, and then expands the macros in the inserted lines. If an optional second template file is provided, %GENERATE_PIC_ROWS%() calls that template and expands once for each picture line item. This allows the 'gallery' page to link each thumbnail to an expanded 'picture' page, one per picture. For full details, see the documentation inside of the .zip file. Last Updated: 4/30/10 |
|||||||
Home | Designs | Machining | School | Downloads | Galleries | Contact Us
|