Customization¶
Simple Layout Adaptions¶
The PHP Mini Gallery is designed that all layout changes need to be made in the template.php file only. There are some special "tags" which can be used for this purpose, so you can adapt the gallery to your needs, without any PHP knowledge.
These tags are available:
- <pmg:if page="index">...</pmg:if>
The content of this container will only be sent to the browser if the index print page is to be shown. - <pmg:if page="picture">...</pmg:if>
The content of this container will only be sent to the browser if a complete picture is to be shown. You cannot nest both <pmg:if> tags, but you can use them as often as you want. - <pmg:first>...</pmg:first>
A link to the gallery's first picture. You can use it like an <a> tag. If there is no appropriate picture, the tag and its content will be omitted. Example:<pmg:first>[ First ]</pmg:first> - <pmg:last>...</pmg:last>
A link to the gallery's last image. - <pmg:toc>...</pmg:toc>
A link to the index print page. - <pmg:prev>...</pmg:prev>
A link to the previous picture. - <pmg:next>...</pmg:next>
A link to the next picture. - <pmg:image/>
This tag replaces the entire image tag and a link to the next picture. The CSS classpicimgcan be used to change the rendering of this picture. For index print view, this tag is empty. - <pmg:caption/>
If there is a caption for this picture, its content will be inserted here. Otherwise the tag is empty. - <pmg:index/>
This tag replaces the entire table containing the thumbnails of all pictures. The CSS classtabindexcan be used to change the rendering of the table. The CSS class thumbimg changes the rendering of the single thumbnail images. - <pmg:count/>
Will be replaced by the total count of the pictures. - <pmg:current/>
Will be replaced by the number of the current picture. This tag is empty for index print views.
The tag parser isn't very smart, and can be fooled quite easily. You should take care to use the tags as explained here, otherwise they might not be recognized and replaced properly. You may want to use the packaged template.php as an example.
Complex Layout Adaptions¶
The template.php is included as PHP script, and thus can also contain PHP language parts. In especially complex cases, you can even implement the entire HTML creation here, instead of using the special tags. You will find all necessary information in the global $CONTEXT array.
The $CONTEXT array contains these keys:
'page'
For complete picture view, you'll find 'picture' here, and 'index' for the index print view.'files'
An array containing the file names of all pictures, in their output order. Thumbnails and scripts are not included here.'count'
The number of pictures'current'
For complete picture view, you'll find the number of the current picture, counted starting with 1. So the file name of the current picture you'll find in 'files' at$CONTEXT['current']-1.'first'
File name of the first picture.'last'
File name of the last picture.'prev'
For complete picture view: file name of the previous picture. This entry is empty if the current picture is the first picture.'next'
For complete picture view: file name of the next picture. This entry is empty if the current picture is the last picture.'pictag'
For complete picture view: the entire image tag for the picture, and a link to the next picture.'caption'
For complete picture view: if the current picture has a caption file, you'll find its content in here.'indextag'
The entire thumbnail table with links to the appropriate pictures.
The special tags will be replaced after executing the template.php, so you can randomly mix PHP script parts and special tags. The access to the $CONTEXT array is read only, though!