This component was designed to allow the rapid display of the most recent images anywhere required within Claromentis.
1. Create file called ComponentImageGallery.php and paste in the following code.
<?php /* * A component to fetch the images from the specified album in the image gallery and display them on homepage one after another. * * @author Sweta Phatangare [sweta@claromentis.com] */ class ComponentImageGallery implements TemplaterComponent { /** * Attribute array values: * album_id (int): To specify the album id of Image gallery of which you wish to display the images */ public function Show($attributes) { global $db; $album_id = $attributes['album_id']; $res = $db->query("SELECT id, title FROM images where album_id = $album_id ORDER BY RAND()"); while($row = $res->fetchArray()) { $id = $row['id']; $title = $row['title']; $image = "/intranet/gallery/thumbnail.php?id=".$id."&prefix=small"; $url = "/intranet/gallery/details.php?id=".$id.""; $value .= "<a href=".$url." /><img src = $image></a>"; } return $value; } } ?>
2. Copy this file into
/intranet/common/classes/
3. Paste the following component code anywhere on templater file
<component class="ComponentImageGallery">
Suggested location:
/interface_{custom}/main/intranet_home.html
or
/interface_{custom}/main/right_column.html
Discussion