<?php header('Content-type: text/html; charset=utf-8'); ?> 
<?php 
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */ 
  require_once "/var/www/vhosts/test.com/httpdocs/admin/lib/viewer_functions.php"; 
 
  list($posterRecords, $posterMetaData) = getRecords(array( 
    'tableName'   => 'poster', 
    'orderBy'     => 'theme', 
  )); 
 
?> 
<!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> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<title></title> 
</head> 
 
<body> 
          <table width="100%" border="0"  align="center" cellpadding="4" cellspacing="4"> 
       <tr> 

		<!-- code added by Ross -->
		<?php $lastTheme; ?>
		<!-- code added by Ross -->

	 <?php foreach ($posterRecords as $record): ?> 
     <!-- This below break the table design because of the maxcols stuff --> 

		<!-- code added by Ross -->
		<?php if ($lastTheme != $record['theme']): ?>
		<h2><?php echo $record['theme'] ?></h2>
		<?php endif; ?>
		<?php $lastTheme = $record['theme']; ?>
		<!-- code added by Ross -->
  
     <!-- ///////////////////////////////////////////////////////////// --> 
    		<?php foreach ($record['photo'] as $upload): ?> 
					<td width="20%" align="left" valign="top"> 
    				<div align="center"> 
    				<a href="<?php echo $upload['urlPath'] ?>" class="thickbox" rel="a"  title="<?php echo $record['title'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" /></a> <br /><?php echo $record['title'] ?> 
						</td> 
    				<?php $maxCols=4; if (@++$count % $maxCols == 0): ?>  
    					</tr> 
    					<tr>  
  					<?php endif ?> 
    		<?php endforeach ?> 



	<?php endforeach; ?>   
	</tr> 
    </table> 
           
 
 
</body> 
</html>

