Knowledgebase: PHP Templating Reference
Gallery Builder Templates (PHP Templates)
Posted by John [Elevated X Support], Last modified by Mark [Elevated X Support] on 28 September 2018 01:58 PM

Gallery Builder Templates (PHP)  - (For Smarty Based FHG templates visit this link.)

Please follow the example files located in your /cms_admin/phptemplate/site0/gallerybuilder/ folder. You can download the default PHP based FHG templates at this URL:

Using the included default templates as a guide you will need to edit the HTML of your own template files to include the code from the photos and/or videos smarty files. You’ll need to save your template using the extension .tpl

The images folder must be named the same as the template so photos.tpl has a folder named 'photos'. A template named 'blue_15pics.tpl' would have a folder named 'blue_15pics'

Join Link Code Tags:

This tag will append the join URL you enter in the admin panel for this template. If you prefer not to have the system populate these tags you can hard code your join links into the templates.

<a href="<?= $template["JoinURL"] ?>"></a>

For each spot in the template you want a photo thumbnail to appear, use the following tag set.

<?php LoadTemplate("photo_item.tpl", ["index" => "1"]) ?>

The "index"=>"1" refers to the location of the photo in the template. When you edit a template in the cms admin panel, Location 1 corresponds to this location. Each spot must be defined with a number that corresponds to its Location in the template as defined in admin. For example if you have a gallery with 5 photos, you would have 5 instances of the tag set above,  ranging from "1" to "5".

<?php LoadTemplate("photo_item.tpl", ["index" => "1"]) ?>

<?php LoadTemplate("photo_item.tpl", ["index" => "2"]) ?>

<?php LoadTemplate("photo_item.tpl", ["index" => "3"]) ?>

<?php LoadTemplate("photo_item.tpl", ["index" => "4"]) ?>

<?php LoadTemplate("photo_item.tpl", ["index" => "5"]) ?>

The same is done for movies, however, the template being loaded is movie_item.tpl as in the following example:

<?php LoadTemplate("movie_item.tpl", ["index" => 1]); ?>

<?php LoadTemplate("movie_item.tpl", ["index" => 2]); ?>

<?php LoadTemplate("movie_item.tpl", ["index" => 3]); ?>

Common tags that can be used to show content in a template:

Appear Date :  <?= $set["AppearDate"] ?>
Expiration Date :  <?= $set["ExpireDate"] ?>
Title : <?= $set["Title"] ?>
Description : <?= $set["Description"] ?>
Join URL : <?= $template["JoinURL"] ?>
Extra Fields: <?= $set["extrafields"]["FIELDNAME"] ?>
(Where FieldName is the extrafield you have set up for that set)

Models name :  <?= $set['info']['models'][0]['name'] ?>

Or for a list of all models by name:
<?php foreach($set["info"]["models"] as $modelkey => $model) { ?>
<?= $model["name"] ?>
<?php if ($modelkey != sizeof($set["info"]["models"]) - 1) { ?>, <?php } ?>
<?php } ?>

Advanced templating (for Coding Experts)
When generating a gallery, the system creates a file called index_debug.html within the destination folder of the gallery. Viewing this file will give you a complete dump of the information available to the user. Please use this file or a reference if looking to do anything more advanced.

(0 vote(s))
Not helpful

Comments (0)