<?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 */

  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/petersmi/public_html/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records
  list($gallerytestRecords, $gallerytestMetaData) = getRecords(array(
    'tableName'   => 'gallerytest',
    'where'       => whereRecordNumberInUrl(33),
    'limit'       => '1',
  ));
  $gallerytestRecord = @$gallerytestRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$gallerytestRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }
 //Get prev/next links using the blog num 
  list($prevRecord, $nextRecord, $firstRecord, $lastRecord) = getPrevAndNextRecords(array( 
    'tableName' => 'gallerytest', 
    'recordNum' => $gallerytest['num'], 
    'orderBy'   => 'createdDate'
  ));
?>
<!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>Peter Smith Construction - Muskoka Cottage Design &amp; Building</title>
<meta http-equiv="keywords" content="muskoka construction, muskoka cottage construction, muskoka cottage builders, cottage builders, custom homes, cottage design, cottage building, custom construction, project management, construction, Muskoka, renovation, general contracting, bracebridge, huntsville, gravenhurst, muskoka lakes, lake of bays, port carling">
<meta http-equiv="description" content="Located in Muskoka, Peter Smith Construction Inc. is a custom home and cottage design and building company, dedicated to providing high quality and dependable custom construction services, using only reputable local professionals.">

  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <style type="text/css">
    body          { font-family: arial; }
    .instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
  </style>

</head> 
<body bgcolor="#2C3358" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
  <tr bgcolor="#2C3358"> 
    <td colspan="2"> 
      <?php include 'includes/top.php';?>
    </td>
  </tr>
  <tr> 
    <td width="136" valign="top" bgcolor="#3E4A7A" background="/images/menu_r11_c1.gif" height="176"> 
      <?php include 'includes/menu.php';?>
    </td>
    <td width="644" valign="top" height="176"> 
      <table width="100%" border="0" cellspacing="3" cellpadding="3" background="bk%20april%201-2011/photos/bgh.jpg">
        <tr> 
          <td valign="top" height="148"> 
            <div align="center">
              <p align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
                <br/>
                Title: 
                <?php echo $gallerytestRecord['title'] ?>
                <br/>
                Photo Description: 
                <?php echo $gallerytestRecord['content'] ?>
                </font></p>
              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
                <!-- STEP 2a: Display Uploads for field 'gallery' (Paste this anywhere inside STEP2 to display uploads) -->
                <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
                <?php foreach ($gallerytestRecord['gallery'] as $upload): ?>
                <img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /> 
                <br />
                <?php endforeach ?>
                <!-- STEP2a: /Display Uploads -->
                <?php if (!$gallerytestRecord): ?>
                No record found!<br/>
                <br/>
                <?php endif ?>
                <!-- show previous and next links -->
Previous Record: <a href="<?php echo (@$prevRecord['_link'])? $prevRecord['_link'] : '?' ; ?>">Previous</a><br>
                Next Record: <a href="<?php echo @$nextRecord['_link']; ?>" >Next</a> 
                First Record: <a href="<?php echo (@$firstRecord['_link'])? $firstRecord['_link'] : '?' ; ?>" >First</a> 
                Last Record: <a href="<?php echo @$lastRecord['_link'] ?>">Last</a><br>
                </font> </p>
            </div>
          </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td colspan="2">
      <?php include 'includes/bottom.php';?>
    </td>
  </tr>
</table>
</body>
</html>