

<?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 "xyz/viewer_functions.php";

  list($categoriesRecords, $selectedCategory) = getCategories(array(     
  'tableName'   => 'category',   
  'selectedCategoryNum' => @$_REQUEST['category'],  
  ));
  
  list($itemRecords, $itemMetaData) = getRecords(array(
    'tableName'   => 'item',
    'perPage'     => '1',
	'orderBy'     => 'num',
  ));
  
  

?>
<!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" />
  <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 -->
  
  <h3>Category Menu</h3>   
  <ul>     
  <li><a href="?">(All Articles)</a></li>     
  <?php foreach ($categoriesRecords as $categoryRecord): ?>       
  <?php echo $categoryRecord['_listItemStart'] ?>              
  <?php if ($categoryRecord['_isSelected']): ?><b><?php endif ?>       
  (<?php echo $categoryRecord['num'] ?>) <a href="?category=<?php echo $categoryRecord['num'] ?>">
  <?php echo $categoryRecord['name'] ?></a>       
  <?php if ($categoryRecord['_isSelected']): ?></b><?php endif ?>              
  <?php echo $categoryRecord['_listItemEnd'] ?>     
  <?php endforeach ?> 
  </ul> 
  
  <!-- /INSTRUCTIONS -->
  <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h3>Articles</h3>
    <?php foreach ($itemRecords as $record): ?>
      
      <strong><?php echo $record['title'] ?></strong><br/>
      <?php echo date("D, M jS,", strtotime($record['date'])) ?><br/>
	  <?php echo $record['content'] ?>
      <a href="<?php echo $record['_link'] ?>">more...</a><br/><br/>
      Record Number: <?php echo $record['num'] ?><br/>
	  Category: <?php echo $record['category'] ?><br/>
      
      <hr/>
    <?php endforeach ?>

    <?php if ($itemMetaData['invalidPageNum']): ?>
      Results page '<?php echo $itemMetaData['page']?>' not found, <a href="<?php echo $itemMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
    <?php elseif (!$itemRecords): ?>
      No records were found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Records -->


  <!-- STEP3: Display Page Links (Paste anywhere below "Load Record List") -->
    <?php if ($itemMetaData['prevPage']): ?>
      <a href="<?php echo $itemMetaData['prevPageLink'] ?>">&lt;&lt; prev</a>
    <?php else: ?>
      &lt;&lt; prev
    <?php endif ?>

    - page <?php echo $itemMetaData['page'] ?> of <?php echo $itemMetaData['totalPages'] ?> -

    <?php if ($itemMetaData['nextPage']): ?>
      <a href="<?php echo $itemMetaData['nextPageLink'] ?>">next &gt;&gt;</a>
    <?php else: ?>
      next &gt;&gt;
    <?php endif ?>
  <!-- /STEP3: Display Page Links -->


</body>
</html>



