<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */
  require_once "C:/wamp/www/sb/core2/admin/lib/viewer_functions.php";

  // load selected department page (do this first)
  list($departmentsRecords, $departmentsMetaData) = getRecords(array(
    'tableName'   => 'departments',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $departmentsRecord = @$departmentsRecords[0]; // get first record

  // load department list
  list($departmentsRecords, $departmentsMetaData) = getRecords(array(
    'tableName'   => 'departments',
    'loadUploads' => '0',
    'allowSearch' => '0',
  ));

?>
<!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>

<table border="1" cellspacing="2" cellpadding="2"><tr><td valign="top">

  <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
    <b>Department List</b><br/>
    <?php foreach ($departmentsRecords as $record): ?>
      <a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br/>
    <?php endforeach; ?>
  <!-- /STEP2: Display Records -->

</td><td>

  <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
    <b>Department Detail</b><br/>
      Title: <?php echo $departmentsRecord['title'] ?><br/>
      Content: <?php echo $departmentsRecord['content'] ?><br/>
      _link : <a href="<?php echo $departmentsRecord['_link'] ?>"><?php echo $departmentsRecord['_link'] ?></a><br/>
  <!-- /STEP2: Display Records -->


</td></tr></table>


</body>
</html>
