Re: [pchell] Photo Gallery setup
Hi,
It looks like the code you submitted has a combination of detail page and list page code. Try this for your detail page:
Change the "require_once" path to match your server.
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "your/path/to/cmsAdmin/lib/viewer_functions.php";
list($galleryRecords, $multi_galleryMetaData) = getRecords(array(
'tableName' => 'multi_gallery',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$galleryRecord = @$galleryRecords[0]; // get first record
// show error message if no matching record is found
if (!$galleryRecord) {
print "Record not found!";
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body>
<h1><?php echo $galleryRecord['title'] ?></h1>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<?php foreach ($galleryRecord['photos'] as $upload): ?>
<td><a href="<?php echo $upload['urlPath'] ?>" title="<?php echo $record['title'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /></a></td>
<?php $maxCols=3; if (@++$count % $maxCols == 0): ?>
</tr><tr>
<?php endif ?>
<?php endforeach; ?>
</tr></table><br/>
<?php if (!$galleryRecord): ?>
No images found!<br/><br/>
<?php endif ?>
</body>
</html>
To set a maximum number of images for each gallery:
- login in to CMS Builder
- go to Admin > Section Editor then select "modify" for Gallery
- click modify for photos
- in the popup, in the "Input Validation" area, you can set the "Maximum uploads". Check the box, enter 15 and save.
I hope this helps. If you have any questions, just let me know.
Cheers,
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/