/** * displayNews($data) * Function that takes an array of news and displays it as html * @param data - associative array of news from the database */ function displayNews($data, $short = false) { date_default_timezone_set("America/New_York"); if (empty($data)) { ReportError("Sorry, we found no news using these parameters."); echo "<br />"; } foreach ($data as $news) { $numComments = getNumOfComments($news['news_id']); OpenContent(); ?> <div class="contentHeading"> <table width="100%"> <tr> <td style="text-align:left;"><?php echo $news['title']; ?> </td> <td style="text-align:right;">Posted by: <?php echo $news['author']; ?> </td> </tr> </table> </div> <div class="content news"> <img src="modules/news/categories/<?php echo $news['catimage']; ?> " alt="<?php echo $news['catname']; ?> " align="right" /> <?php if ($short) { echo substr(bbcode_format($news['message']), 0, 1000) . "..."; echo '<br /><br /><a href="?load=news&id=' . $news['news_id'] . '">Continue reading.</a>'; } else { echo bbcode_format($news['message']); } if (!is_null($news['eauthor'])) { echo "<br /><div style=\"text-align:right; font-size: 10px; font-style:italic;\">Last edit: " . date('F j, Y, g:i a T', strtotime($news['edited'])) . " by " . $news['eauthor'] . "</div>"; } ?> </div> <div class="contentFooter"> <table width="100%"> <tr> <td style="text-align:left;"> View Comments: <a href="<?php echo $_SERVER['PHP_SELF']; ?> ?load=news&id=<?php echo $news['news_id']; ?> "><?php echo $numComments; ?> Comments</a> </td> <td style="text-align:right;">Posted: <?php echo date('D F j, Y, g:i a T', strtotime($news['date'])); ?> </td> </tr> </table> </div> <?php CloseContent(); echo "<br />"; } }
<?php include "../include/login.inc.php"; include "header.inc.php"; define(PROJECTTYPE, 4); define(PROJECTTYPETEXTPC, "Libraries"); // endings: p = plural / s = singular / c = capitalized define(PROJECTTYPETEXTP, "libraries"); define(PROJECTTYPETEXTSC, "Library"); define(PROJECTTYPETEXTS, "library"); BeginContent(PROJECTTYPETEXTPC); include "../include/projects.inc.php"; CloseContent(); include "footer.inc.php";
function CloseBlock() { echo "</div>"; CloseContent(); }