<?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/content/g/o/f/gofgof/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($productsRecords, $productsMetaData) = getRecords(array(
    'tableName'   => 'products',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $productsRecord = @$productsRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$productsRecord) {
    header("HTTP/1.0 404 Not Found");
    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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="http://www.greetingsoffaith.com/gofstyle.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div class="container">
  <div class="header"><?php include ("includes/header.php"); ?>
    <!-- end .header --></div>
  <div class="sidebar1"><?php include ("includes/navigation.php"); ?>
    <!-- end .sidebar1 --></div>
    <div class="content">
    <h1>Header</h1>
    <p>
  <!-- /INSTRUCTIONS -->

  <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
    <h1>Products - Detail Page Viewer</h1>
      Record Number: <?php echo $productsRecord['num'] ?><br/>
      Categories: <?php echo $productsRecord['categories'] ?><br/>
      Number: <?php echo $productsRecord['number'] ?><br/>
      Retail: <?php echo $productsRecord['retail'] ?><br/>
      Code: <?php echo $productsRecord['code'] ?><br/>
      Size: <?php echo $productsRecord['size'] ?><br/>
      Finish: <?php echo $productsRecord['finish'] ?><br/>
      Scripture Text: <?php echo $productsRecord['scripture_text'] ?><br/>
      Bible Verse: <?php echo $productsRecord['bible_verse'] ?><br/>
      _link : <a href="<?php echo $productsRecord['_link'] ?>"><?php echo $productsRecord['_link'] ?></a><br/>


      <!-- STEP 2a: Display Uploads for field 'images' (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 ($productsRecord['images'] as $upload): ?>
          <?php if ($upload['hasThumbnail']): ?>
            <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

          <?php elseif ($upload['isImage']): ?>
            <img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

          <?php else: ?>
            <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

          <?php endif ?>
        <?php endforeach ?>
      <!-- STEP2a: /Display Uploads -->


      <hr/>
    <?php if (!$productsRecord): ?>
      No record found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Records -->

  <a href="<?php echo $productsMetaData['_listPage']; ?>">&lt;&lt; Back to list page</a> - 
  <a href="mailto:?subject=<?php echo thisPageUrl() ?>">Email this Page</a>
</p>
    <!-- end .content --></div>
  <div class="sidebar2">
    <h4>&nbsp;</h4>
    <!-- end .sidebar2 --></div>
  <div class="footer">
  <p><?php include ("includes/footer.php"); ?></p>
    <!-- end .footer --></div>
  <!-- end .container --></div>
</body>
</html>