Knowledgebase: PHP Templating Reference
PHP Template Function: StdImage
Posted by Mark [Elevated X Support], Last modified by kayako kayako on 02 November 2018 10:38 AM

Description:

This will print an image for a specific set that is passed to it.

Common Location:

/cms_admin/phptemplate/<templatefolder>/functions/standard.tpl

Usage:

<?php foreach ($sets as $set) { ?>

<?php StdImage(array("set" => $set, "usepriority" => "14,20,21,22,23,24,25", "alt" => "", "class" => "update_thumb thumbs")); ?>

<?php } ?>

Arguments

There is only one argument that is passed to StdImage(), however, it is an associative array with the following possible elements:

set: This is an array containing all of the metadata for a set (which comes from the CMS)
usepriority: These are a list of thumbnail slots that the function should look for and use, separated by commas.
If multiple priorities are listed, use the first priority within the image, and use subsequent priorities as rollover images.

In the above example:
14,20,21,22,23,24,25

The system will show a priority 14 thumbnail, but when the user mouses over the thumbnail, the images will cycle through a priority 20,21,22,23,24 and 25 image before returning to a priority 14 image.

alt: This is the alt tag that should show on the image.
class: These are the CSS classes that will apply to the image.

Output

Here's an example of the output this function will do:

<img id="set-target-133" alt="" class="update_thumb thumbs stdimage" src="/members_php/content//contentthumbs/760.jpg" src0="/members_php/content//contentthumbs/760.jpg" src1="/members_php/content//contentthumbs/9275.jpg" src2="/members_php/content//contentthumbs/9276.jpg" src3="/members_php/content//contentthumbs/9277.jpg" src4="/members_php/content//contentthumbs/9280.jpg" src5="/members_php/content//contentthumbs/9279.jpg" src6="/members_php/content//contentthumbs/9278.jpg" cnt="7" v="0" height="170" width="235">

The standard CMS template has JavaScript functionality that takes all image tags with the class "stdimage", and rotates through src0, src1... src6 when the user mouses over the image.

(0 vote(s))
Helpful
Not helpful

Comments (0)