<?php
/*
  $Id: latest_news.php,v 1.2 2002/11/11 06:38:08 will Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2002 Will Mays

  Released under the GNU General Public License
*/
?>
<!-- latest_news //-->
<?php
  
  $latest_news_query = tep_db_query('SELECT * from ' . TABLE_LATEST_NEWS . ' WHERE status = 1 ORDER BY date_added DESC LIMIT ' . MAX_DISPLAY_LATEST_NEWS);

  if (!tep_db_num_rows($latest_news_query)) { // there is no news
    echo '<!-- ' . TEXT_NO_LATEST_NEWS . ' -->';
  } else {
    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'left',
                                 'text'  => TABLE_HEADING_LATEST_NEWS);
    new contentBoxHeading($info_box_contents);

    $info_box_contents = array();
    $row = 0;
    while ($latest_news = tep_db_fetch_array($latest_news_query)) {
      $info_box_contents[$row] = array('align' => 'left',
                                       'params' => 'class="smallText" valign="top"',
                                       'text' => '<b>' . $latest_news['headline'] . '</b> - <i>' . tep_date_long($latest_news['date_added']) . '</i><br>' . nl2br($latest_news['content']) . '<br>');
      $row++;
    }
    new contentBox($info_box_contents);
  }
?>
<!-- latest_news_eof //-->
