<?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('/home2/ngpymrmy/public_html/pollick/','','../','../../','../../../');
  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 from 'photo_galleries'
  list($photo_galleriesRecords, $photo_galleriesMetaData) = getRecords(array(
    'tableName'   => 'photo_galleries',
    'loadUploads' => true,
    'allowSearch' => false,
  ));

list($common_informationRecords, $common_informationMetaData) = getRecords(array(
    'tableName'   => 'common_information',
    'where'       => '', // load first record
    'loadUploads' => true,
    'allowSearch' => false,
    'limit'       => '1',
  ));
  $common_informationRecord = @$common_informationRecords[0]; // get first record
  
  list($google_font_namesRecords, $google_font_namesMetaData) = getRecords(array(
    'tableName'   => 'google_font_names',
  ));
  
  // load records from 'navigation_menu_links'
  list($navigation_menu_linksRecords, $navigation_menu_linksMetaData) = getRecords(array(
    'tableName'   => 'navigation_menu_links',
    'loadUploads' => true,
    'allowSearch' => false, 
	));
?><!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title></title>
  <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>
  
  <!-- INSTRUCTIONS -->
    <div class="instructions">
      <b>Sample List Viewer - Instructions:</b>
      <ol>
        <?php /*><li style="color: red; font-weight: bold">Rename this file to have a .php extension!</li><x */ ?>
        <li><b>Remove any fields you don't want displayed.</b></li>
        <li>Rearrange remaining fields to suit your needs.</li>
        <li>Copy and paste code into previously designed page (or add design to this page).</li>
      </ol>
    </div>
  <!-- /INSTRUCTIONS -->

  <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
    <h1>Photo Galleries - List Page Viewer</h1>
    <?php foreach ($photo_galleriesRecords as $record): ?>
      Record Number: <?php echo htmlencode($record['num']) ?><br/>
      Title: <?php echo htmlencode($record['title']) ?><br/>
      Sub Title: <?php echo htmlencode($record['sub_title']) ?><br/>
      Description (optional): <?php echo htmlencode($record['description']) ?><br/>
      _link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>

      <!-- STEP 2a: Display Uploads for field 'images' (Paste this anywhere inside STEP2 to display uploads) -->
        <!-- Upload Fields: extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
        Images: (Copy the tags from below that you want to use, and erase the ones you don't need)
        <blockquote>
        <?php foreach ($record['images'] as $index => $upload): ?>
          Upload Url: <?php echo htmlencode($upload['urlPath']) ?><br/>


          Thumb Url: <?php echo htmlencode($upload['thumbUrlPath']) ?><br/>
          Thumb2 Url: <?php echo htmlencode($upload['thumbUrlPath2']) ?><br/>
          Thumb3 Url: <?php echo htmlencode($upload['thumbUrlPath3']) ?><br/>
          Thumb4 Url: <?php echo htmlencode($upload['thumbUrlPath4']) ?><br/><br/>
          Download Link: <a href="<?php echo htmlencode($upload['urlPath']) ?>">Download <?php echo htmlencode($upload['filename']) ?></a><br/><br/>

          Image Tags:<br/>
          <img src="<?php echo htmlencode($upload['urlPath']) ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" />
          <img src="<?php echo htmlencode($upload['thumbUrlPath']) ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
          <img src="<?php echo htmlencode($upload['thumbUrlPath2']) ?>" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" alt="" />
          <img src="<?php echo htmlencode($upload['thumbUrlPath3']) ?>" width="<?php echo $upload['thumbWidth3'] ?>" height="<?php echo $upload['thumbHeight3'] ?>" alt="" />
          <img src="<?php echo htmlencode($upload['thumbUrlPath4']) ?>" width="<?php echo $upload['thumbWidth4'] ?>" height="<?php echo $upload['thumbHeight4'] ?>" alt="" /><br/>

          info1 (Caption) : <?php echo htmlencode($upload['info1']) ?><br/>
          info2 (Caption (continued)) : <?php echo htmlencode($upload['info2']) ?><br/>
          info3 (Caption (continued)) : <?php echo htmlencode($upload['info3']) ?><br/>
          info4 (Caption (continued)) : <?php echo htmlencode($upload['info4']) ?><br/><br/>

          Extension: <?php echo $upload['extension'] ?><br/>
          isImage: <?php if ($upload['isImage']): ?>Yes<?php else: ?>No<?php endif ?><br/>
          hasThumbnail: <?php if ($upload['hasThumbnail']): ?>Yes<?php else: ?>No<?php endif ?><br/>
          <hr/>

        <?php endforeach ?>
        </blockquote>
      <!-- STEP2a: /Display Uploads -->

      <hr/>
    <?php endforeach ?>

    <?php if (!$photo_galleriesRecords): ?>
      No records were found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Records -->

</body>
</html>
