<?xml version="1.0" encoding="utf-8"?> 
<!-- 
  - contains news information
  - each news item has the id, title, preview (the big image) and description attributes
  - the id is the same for both xml and html layout file  
  
  Note: for id attribute you need to specify  the odd cell id (this is the first cell id in a row in the html file)
  
-->
 <?
   include ("/home2/thegaunt/www/common/connectdb.php");
   function band_name($t_id) {
   global $link;
   $sql = "SELECT band FROM bands WHERE bid = '$t_id'" ;
   $sql_result = mysql_query ($sql, $link ) or die ('request "Could not execute SQL query"');
   $row = mysql_fetch_row( $sql_result );
   return $row[0];
 };

 function band_image($t_id) {
   global $link;
   $sql = "SELECT bandimage FROM photos WHERE pid = '$t_id'" ;
   $sql_result = mysql_query ($sql, $link ) or die ('request "Could not execute SQL query"');
   $row = mysql_fetch_row( $sql_result );
   return $row[0];
 };
	$result = mysql_query( "SELECT * FROM news WHERE status=1 ORDER BY id DESC LIMIT 0, 15 " );
	while ( $row = mysql_fetch_object( $result ) )
	{
	$string = "$row->article_title";
	$string2 = "$row->article_caption";
        $patterns[0] = '/ /';
		$patterns[1] = '/\'/';
		$patterns[2] = '/\//';
        $patterns[3] = '/$/';
        $patterns[4] = '/\@/';
        $patterns[5] = '/\?/';
        $patterns[6] = '/\"/';
		$replacements[0] = '-';
		$replacements[1] = '';
		$replacements[2] = '-';
        $replacements[3] = '';
        $replacements[4] = '';
        $replacements[5] = '';
        $replacements[6] = '';
		$newname = preg_replace($patterns, $replacements, $string);
		$caption = preg_replace($patterns, $replacements, $string2);
?>

<news>
	<item id="v<?php echo "$row->id"; ?>" title="<?php echo $string ?>" preview="http://images.thegauntlet.com/pics/<? echo band_image($row->pid); ?>"><![CDATA[<?php echo "$row->article"; ?><br />SOURCE: <a href="http://www.thegauntlet.com">The Gauntlet</a>]]></item>
</news>
<? } ?>