<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  require_once "/usr/www/users/thephila/cmsAdmin/lib/viewer_functions.php";

  list($new_newsletterRecords, $new_newsletterMetaData) = getRecords(array(
    'tableName'   => 'new_newsletter',
    'loadUploads' => '0',
    'allowSearch' => '1', 
  ));
  $new_newsletterRecord = @$new_newsletterRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$new_newsletterRecord) {
    print "Record not found!";
    exit;
  }

?>

<table>
<tr>
<td style="width: 300px; vertical-align:top;" >
<table style="width: 100%">
	<tr>
		<td style="width: 300px; vertical-align:top;" class="subnav_background"> 
		<div id="sub">

		<?php $pg_link = ""; ?>
		<?php $pg_ref = ""; ?>
		<?php $compare = ""; ?>
		<?php $link_class = ""; ?>
		<?php $pg_name = ( $_SERVER['REQUEST_URI']); ?>

		<ul>
			<li><a href="http://www.tpschool.org/wnw/new.newsletter.php" class="pad">Back to Newsletters</a></li>		
			<?php $lastBox = ""; ?> 		
		    <?php foreach ($new_newsletterRecords as $record): ?>
			<?php $pg_link = $record['_link']; ?>
				<?php $compare = strpos($pg_link,$pg_name); ?>
				<?php if ($compare === false ):?>
					<?php $link_class = "pad"; ?>
					<li><a href="<?php echo $record['_link']; ?>" class="<?php echo $link_class; ?>"><?php echo $record['title']; ?></a></li>
				<?php else: ?>
					<?php $link_class = "idselect"; ?>
					<li class="<?php echo $link_class; ?>"><?php echo $record['title']; ?></li>
				<?php endif; ?>

			<?php endforeach; ?>
		</ul>
		</div>
		</td>