| 1 | <html> |
|---|
| 2 | <head> |
|---|
| 3 | <title>Picasa Web Templating</title> |
|---|
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
|---|
| 5 | <link rel="stylesheet" href="style.css" type="text/css"> |
|---|
| 6 | </head> |
|---|
| 7 | <body bgcolor="#FFFFFF" text="#000000"> |
|---|
| 8 | <h1>The Picasa Web Templating System</h1> |
|---|
| 9 | <h2>Overview</h2> |
|---|
| 10 | |
|---|
| 11 | When the user does a web page export from the current album in Picasa, the Picasa Web Templating system is used to produce the |
|---|
| 12 | desired HTML output. Web templates may be either template command (.tpl) files, or <a href="#includedFile">files which contain HTML formatting</a> |
|---|
| 13 | and special templating-system variables (typically with the extension .html)<p> |
|---|
| 14 | |
|---|
| 15 | During an export, thumbnail and large-sized copies of the selected images are written to the "thumbnail" and "image" subdirectories of the selected |
|---|
| 16 | export directory, respectively. Then, the top-level template command file (always "index.tpl") in a template directory is |
|---|
| 17 | processed and the <a href="#templateCommands">commands</a> executed in order. The special <a href="#loopCommand">loop</a> |
|---|
| 18 | and <a href="#targetloopCommand">targetloop</a> commands are processed for each image in the selection, populating the |
|---|
| 19 | special <a href="#imageVars">image loop</a> and |
|---|
| 20 | <a href="#targetVars">targetloop</a> variables.<p> |
|---|
| 21 | |
|---|
| 22 | Features which have not yet been implemented are indicated <span class="notImplemented">like this</span>.<p><p> |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | <h2><a name="templateCommands">Template Command (.tpl) Files</a></h2> |
|---|
| 26 | <table> |
|---|
| 27 | <caption>Template File Commands</caption> |
|---|
| 28 | <tr><th width="15%">Command</th><th width="40%">Parameters</th><th>Description</th></tr> |
|---|
| 29 | <tr class="commandrow"><td class="commandcell">define</td> |
|---|
| 30 | <td class="commandcell"> |
|---|
| 31 | <table> |
|---|
| 32 | <tr><td class="parameterName" width="180">variableName</td><td>The name you'd like to use elsewhere</td></tr> |
|---|
| 33 | <tr><td class="parameterName">variableValue</td><td>The value to substitute in</td></tr> |
|---|
| 34 | </table> |
|---|
| 35 | </td> |
|---|
| 36 | <td class="commandcell">Define a value which will be used internally by the exporter, as well as replaced automatically wherever <code><%variableName%></code> is encountered. <span class="exampleTitle">Example</span>: |
|---|
| 37 | <code>define imageWidth 600</code> -- sets the default image width of exported images to 600 pixels, and replaces any occurances of <code><%imageWidth%></code> with "600".<p> |
|---|
| 38 | At any given time, only one instance of a variable is active, so placing a "<code>define imageWidth 400</code>" on any line below "<code>define imageWidth 600</code>" will override all instances of the imageWidth definition.<p> |
|---|
| 39 | Some variables are used internally to control export behavior. They are listed in their <a href="#commandVariables">own table</a> below. |
|---|
| 40 | </td></tr> |
|---|
| 41 | |
|---|
| 42 | <tr class="commandrow"><td class="commandcell">include</td> |
|---|
| 43 | <td class="commandcell"> |
|---|
| 44 | <table> |
|---|
| 45 | <tr><td class="parameterName" width="180">fileName</td><td class="commandcell">An HTML or template file to include at this point.</td></tr> |
|---|
| 46 | </table> |
|---|
| 47 | </td> |
|---|
| 48 | <td class="commandcell">Template files are processed recursively, variables are substituted in HTML files at the point where they are included. |
|---|
| 49 | </td></tr> |
|---|
| 50 | |
|---|
| 51 | <tr class="commandrow"><td><a name="loopCommand">loop</a></td> |
|---|
| 52 | <td> |
|---|
| 53 | <table> |
|---|
| 54 | <tr><td class="parameterName" width="180">per-image include file</td><td class="commandcell">This file will be included once per image.</td></tr> |
|---|
| 55 | <tr><td class="parameterName">columnCount</td><td class="commandcell"><span class="notImplemented">The number of images to place in a single row (usually of a table). If this parameter is specified, |
|---|
| 56 | then you must also specify the rowStartInclude and rowEndInclude parameters</span></td></tr> |
|---|
| 57 | <tr><td class="parameterName">rowStartInclude</td><td class="commandcell"><span class="notImplemented">include this file at the start of each row (for example, "<code><TR></code>")</span></td></tr> |
|---|
| 58 | <tr><td class="parameterName">rowEndInclude</td><td class="commandcell"><span class="notImplemented">include this file at the end of each row (for example, "<code></TR></code>")</span></td></tr> |
|---|
| 59 | </table> |
|---|
| 60 | </td> |
|---|
| 61 | <td class="commandcell">The <code>loop</code> and <code>targetloop</code> commands both loop over all the images in the export selection. Certain variables (indicated below) are active only for files |
|---|
| 62 | included via the loop directives.</td></tr> |
|---|
| 63 | |
|---|
| 64 | <tr class="commandrow"><td><a name="targetloopCommand">targetloop</a></td> |
|---|
| 65 | <td> |
|---|
| 66 | <table> |
|---|
| 67 | <tr><td class="parameterName" width="180">target template file</td><td>Template file which specifies the export for the per-image HTML file.</td></tr> |
|---|
| 68 | <tr><td class="parameterName">target include file</td><td>In the current export file, this file is included once per image, with the special variable <code><%targetPath%></code> defined, which points to the per-image export file.</td></tr> |
|---|
| 69 | <tr><td class="parameterName">columnCount</td><td class="commandcell"><span class="notImplemented">The number of images to place in a single row (usually of a table). If this parameter is specified, |
|---|
| 70 | then you must also specify the rowStartInclude and rowEndInclude parameters</span></td></tr> |
|---|
| 71 | <tr><td class="parameterName">rowStartInclude</td><td class="commandcell"><span class="notImplemented">include this file at the start of each row (for example, "<code><TR></code>")</span></td></tr> |
|---|
| 72 | <tr><td class="parameterName">rowEndInclude</td><td class="commandcell"><span class="notImplemented">include this file at the end of each row (for example, "<code></TR></code>")</span></td></tr> |
|---|
| 73 | </table> |
|---|
| 74 | </td> |
|---|
| 75 | <td><code>targetloop</code> causes each image to be exported to a separate file, which may be referenced by the current file. It is used for frame-based designs. |
|---|
| 76 | </td></tr> |
|---|
| 77 | |
|---|
| 78 | <tr class="commandrow"><td>copy</td> |
|---|
| 79 | <td> |
|---|
| 80 | <table> |
|---|
| 81 | <tr><td class="parameterName" width="180">source</td><td>A directory, relative to the current template, to copy recursively to <code>destination</code></td></tr> |
|---|
| 82 | <tr><td class="parameterName">destination</td><td>(optional) A path relative to the current export directory to which the files in <code>source</code> are copied</td></tr> |
|---|
| 83 | </table> |
|---|
| 84 | </td> |
|---|
| 85 | <td> |
|---|
| 86 | Copies static resources (such as artwork) from the template directory to the export directory. <span class="exampleTitle">Example</span>: |
|---|
| 87 | <code>copy assets\images\ images\</code> -- copies the contents of the "images" directory in the "assets" directory of the current template to the "images" directory of |
|---|
| 88 | the current export. Note that the trailing backslashes are required for directory specifications, and that leading backslashes should not be used. |
|---|
| 89 | </td></tr> |
|---|
| 90 | </table> |
|---|
| 91 | <p> |
|---|
| 92 | <p> |
|---|
| 93 | <h2>Command Variables</h2> |
|---|
| 94 | Some variables are used internally by the exporter (they are also accessible within the HTML). |
|---|
| 95 | <p> |
|---|
| 96 | <table> |
|---|
| 97 | <caption><a name="commandVariables">Command Variables</a></caption> |
|---|
| 98 | <tr valign="top"><th>Variable Name</th><th>Description</th></tr> |
|---|
| 99 | <tr valign="top"><td class="variableName">exportFileName</td><td class="variableDescription">Name to use for the exported file. For targetloop files, a numerical value will be appended to this name, before the extension. |
|---|
| 100 | In other words, for a regular template file a value of "index.html" will produce an exported file named "index.html" but for a targetloop template, the files "index0.html," "index1.html," etc. will be produced.</td></tr> |
|---|
| 101 | <tr valign="top"><td class="variableName">imageWidth</td><td class="variableDescription">Maximum image width to use when generating the large-sized image files. A value of "0" means "Same width as the original image."</td></tr> |
|---|
| 102 | <tr valign="top"><td class="variableName">imageHeight</td><td class="variableDescription">Maximum image height to use when generating the large-sized image files. A value of "0" means "Same height as the original image."</td></tr> |
|---|
| 103 | <tr valign="top"><td class="variableName">thumbnailWidth</td><td class="variableDescription">Maximum image width to use when generating the thumbnail image files. A value of "0" means "Same width as the original image."</td></tr> |
|---|
| 104 | <tr valign="top"><td class="variableName">thumbnailHeight</td><td class="variableDescription">Maximum image height to use when generating the thumbnail image files. A value of "0" means "Same height as the original image."</td></tr> |
|---|
| 105 | <tr valign="top"><td class="variableName">bgColor</td><td class="variableDescription">Color to use when creating shadows around thumbnails. Default is white ("#FFFFFF")</td></tr> |
|---|
| 106 | <tr valign="top"><td class="variableName">shadowedThumbnails</td><td class="variableDescription">If set to "true" or "1", draw a shadow around each exported thumbnail. Defaults to "1"</td></tr> |
|---|
| 107 | <tr valign="top"><td class="variableName">shadowedImages</td><td class="variableDescription">If set to "true" or "1", draw a shadow around each exported image. Defaults to "0"</td></tr> |
|---|
| 108 | </table> |
|---|
| 109 | <p> |
|---|
| 110 | <h2><a name="includedFile">Included HTML Files</a></h2> |
|---|
| 111 | The following variables will be active for any page: |
|---|
| 112 | |
|---|
| 113 | <table> |
|---|
| 114 | <caption>Album variables</caption> |
|---|
| 115 | <tr valign="top"><th>Variable Name</th><th>Description</th></tr> |
|---|
| 116 | <tr valign="top"><td class="variableName">albumNumber</td><td class="variableDescription">A number which is unique across all albums in this instance of the Picasa database. Sometimes useful for javascript.</td></tr> |
|---|
| 117 | <tr valign="top"><td class="variableName">albumName</td><td class="variableDescription">The short name assigned to this album. Initially the name of the directory that contained the album's images, but editable by the user.</td></tr> |
|---|
| 118 | <tr valign="top"><td class="variableName">albumCaption</td><td class="variableDescription">A description of the photographs that the user has entered.</td></tr> |
|---|
| 119 | <tr valign="top"><td class="variableName">albumDate</td><td class="variableDescription">Initially, the median date of all photos in the album. May be changed by the user. Formatted as month/year only.</td></tr> |
|---|
| 120 | <tr valign="top"><td class="variableName">albumItemCount</td><td class="variableDescription">Total number of images in this album.</td></tr> |
|---|
| 121 | </table> |
|---|
| 122 | <p> |
|---|
| 123 | <p> |
|---|
| 124 | Within an image loop, (including any files exported within a targetloop) the following variables will be active in addition to the album variables above: |
|---|
| 125 | <p> |
|---|
| 126 | <table> |
|---|
| 127 | <caption><a name="imageVars">Image Loop Variables</a></caption> |
|---|
| 128 | <tr valign="top"><th>Variable Name</th><th>Description</th></tr> |
|---|
| 129 | <tr valign="top"><td class="variableName">itemNumber</td><td class="variableDescription">A number which is unique across all albums in this instance of the Picasa database. Sometimes useful for javascript.</td></tr> |
|---|
| 130 | <tr valign="top"><td class="variableName">itemName</td><td class="variableDescription">The name of the image file ("mypicture.jpg")</td></tr> |
|---|
| 131 | <tr valign="top"><td class="variableName">itemOriginalPath</td><td class="variableDescription">The full path to the original file on disk ("C:\My Documents\My Pictures\mypicture.jpg").</td></tr> |
|---|
| 132 | <tr valign="top"><td class="variableName">itemWidth</td><td class="variableDescription">Actual width of the exported picture, in pixels. Usually smaller than the "imageWidth" command variable.</td></tr> |
|---|
| 133 | <tr valign="top"><td class="variableName">itemHeight</td><td class="variableDescription">Actual height of the exported picture, in pixels. Usually smaller than the "imageHeight" command variable.</td></tr> |
|---|
| 134 | <tr valign="top"><td class="variableName">itemSize</td><td class="variableDescription">Size of the <em>original</em> image, in kilobytes.</td></tr> |
|---|
| 135 | <tr valign="top"><td class="variableName">itemThumbnailImage</td><td class="variableDescription">Path to the exported thumbnail image file, relative to the export directory.</td></tr> |
|---|
| 136 | <tr valign="top"><td class="variableName">itemLargeImage</td><td class="variableDescription">Path to the exported large image file, relative to the export directory.</td></tr> |
|---|
| 137 | <tr valign="top"><td class="variableName">isNextImage</td><td class="variableDescription">true if there is an image following the current image</td></tr> |
|---|
| 138 | <tr valign="top"><td class="variableName">isPrevImage</td><td class="variableDescription">true if there is an image preceding the current image</td></tr> |
|---|
| 139 | <tr valign="top"><td class="variableName">nextImage</td><td class="variableDescription">Path to the next exported image, in sequence, relative to the export directory.</td></tr> |
|---|
| 140 | <tr valign="top"><td class="variableName">prevImage</td><td class="variableDescription">Path to the previous exported image, in sequence, relative to the export directory.</td></tr> |
|---|
| 141 | <tr valign="top"><td class="variableName">nextThumbnail</td><td class="variableDescription">Path to the next exported thumbnail image, in sequence, relative to the export directory.</td></tr> |
|---|
| 142 | <tr valign="top"><td class="variableName">prevThumbnail</td><td class="variableDescription">Path to the previous exported thumbnail image, in sequence, relative to the export directory.</td></tr> |
|---|
| 143 | |
|---|
| 144 | </table> |
|---|
| 145 | <p> |
|---|
| 146 | <p> |
|---|
| 147 | |
|---|
| 148 | Within a target page, the following variables will be active in addition to the album and image loop variables above: |
|---|
| 149 | <p> |
|---|
| 150 | <table> |
|---|
| 151 | <caption><a name="targetVars">Target Page Variables</a></caption> |
|---|
| 152 | <tr valign="top"><th>Variable Name</th><th>Description</th></tr> |
|---|
| 153 | <tr valign="top"><td class="variableName">referrer</td><td class="variableDescription">Path to the page which points to this page (so you can implement a "back" link)</td></tr> |
|---|
| 154 | <tr valign="top"><td class="variableName">isNextTarget</td><td class="variableDescription">true if there is a target following the current target</td></tr> |
|---|
| 155 | <tr valign="top"><td class="variableName">isPrevTarget</td><td class="variableDescription">true if there is a target preceding the current target</td></tr> |
|---|
| 156 | <tr valign="top"><td class="variableName">isFirstTarget</td><td class="variableDescription">true if the current target is the first one</td></tr> |
|---|
| 157 | <tr valign="top"><td class="variableName">isLastTarget</td><td class="variableDescription">true if the current target is the first one</td></tr> |
|---|
| 158 | <tr valign="top"><td class="variableName">nextTarget</td><td class="variableDescription">path to the next target file in sequence</td></tr> |
|---|
| 159 | <tr valign="top"><td class="variableName">prevTarget</td><td class="variableDescription">path to the previous target file in sequence</td></tr> |
|---|
| 160 | <tr valign="top"><td class="variableName">firstTarget</td><td class="variableDescription">path to the first target file in sequence</td></tr> |
|---|
| 161 | <tr valign="top"><td class="variableName">lastTarget</td><td class="variableDescription">path to the last target file in sequence</td></tr> |
|---|
| 162 | <tr valign="top"><td class="variableName">outputIndex</td><td class="variableDescription">Number within the total number of images represented by this page (i.e. "5"). Used for creating the export filename, but useful inside HTML.</td></tr> |
|---|
| 163 | </table> |
|---|
| 164 | <p> |
|---|
| 165 | <p> |
|---|
| 166 | |
|---|
| 167 | |
|---|
| 168 | Within a targetloop (in a containing page) the following variables will be active in addition to the album and image loop variables above: |
|---|
| 169 | <p> |
|---|
| 170 | <table> |
|---|
| 171 | <caption>Target Loop Variables</caption> |
|---|
| 172 | <tr valign="top"><th>Variable Name</th><th>Description</th></tr> |
|---|
| 173 | <tr valign="top"><td class="variableName">targetPath</td><td>path to the exported target page</td></tr> |
|---|
| 174 | </table> |
|---|
| 175 | <p> |
|---|
| 176 | <p> |
|---|
| 177 | Conditional variables can be used for optional inclusion of text -- for example, if you want to deactivate a "previous" button on the first image of a set. |
|---|
| 178 | Any conditional variable can be preceded by "!" which reverses its meaning.<p> |
|---|
| 179 | Conditionals are used like so |
|---|
| 180 | <pre> |
|---|
| 181 | <%if isNextImage%>Some HTML goes here<%endif%><%if !isNextImage%>(no more images)<%endif%> |
|---|
| 182 | </pre> |
|---|
| 183 | </body> |
|---|
| 184 | </html> |
|---|