<?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 "C:/wamp/www/cmsbuilder_1_31/cmsAdmin/lib/viewer_functions.php";

  list($publicProjectsRecords, $projectsMetaData) = getRecords(array(
    'tableName'   => 'projects',
    'where'       => 'access = "Public"'
  ));

  list($privateProjectsRecords, $projectsMetaData) = getRecords(array(
    'tableName'   => 'projects',
    'where'       => 'access = "Private"'
  ));

?>
<!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; }
  </style>
 </head>
<body>

  <!-- STEP2: Display Public Projects -->
    <h1>Public Projects</h1>
    <?php foreach ($publicProjectsRecords as $record): ?>
      Record Number: <?php echo $record['num'] ?><br/>
      Title: <?php echo $record['title'] ?><br/>
      Content: <?php echo $record['content'] ?><br/>
      Access: <?php echo $record['access'] ?><br/>
      _link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>

      <hr/>
    <?php endforeach; ?>

    <?php if (!$publicProjectsRecords): ?>
      No public projects were found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Public Projects -->

  <!-- STEP2: Display Private Projects -->
    <h1>Private Projects</h1>
    <?php foreach ($privateProjectsRecords as $record): ?>
      Record Number: <?php echo $record['num'] ?><br/>
      Title: <?php echo $record['title'] ?><br/>
      Content: <?php echo $record['content'] ?><br/>
      Access: <?php echo $record['access'] ?><br/>
      _link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>

      <hr/>
    <?php endforeach; ?>

    <?php if (!$privateProjectsRecords): ?>
      No private projects were found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Private Projects -->

</body>
</html>
