Location: PHPKode > projects > Arab Cart > arabCart/external.php
<?php
/*
  ArabCart, Free E-Commerce Solutions
  http://www.arabcart.info

  Copyright (c) 2005 Mhd Zaher Ghaibeh

  Released under the GNU General Public License
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
  USA.
*/


require_once("connections/connection.php");

require_once("includes/lang-eng.php");

require_once("info.php");

$sql="select * from products order by id limit 0,10";

$result=mysql_query($sql);

if(mysql_num_rows($result)!=0)

{

	// set XML type and nocache headers

	header('Content-Type: text/xml');

	header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');

	header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

	header('Pragma: public');



	echo '<?xml version="1.0" encoding="' . charset . '"?>' . "\r\n";

		echo '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">' . "\r\n";

	echo '<rss version="0.91">' . "\r\n";

	echo '<channel>';

	echo "\t<title>" . $_sitename . "</title>\r\n";

	echo "\t<link>". $_siteUrl ."</link>\r\n";

	echo "\t<description>" . $_siteDescription . "</description>\r\n";

	echo "	<language>en-us</language>\r\n\r\n";





  while($row=mysql_fetch_object($result))

  {

			$short=str_replace("<br />","\n",$row->short_desc);

			echo "\t<item>\r\n";

			echo "\t\t<title><![CDATA[".$row->name."]]></title>\r\n";

			echo "\t\t<link>".$_siteUrl ."/showproduct.php?id=".$row->id."</link>\r\n";

			echo "\t\t<description><![CDATA[$short]]></description>\r\n";

			echo "\t</item>\r\n";

  }

	echo "</channel>\r\n";

	echo "</rss>";

	

}

elseif(mysql_num_rows($result)==0)

{

	// set XML type and nocache headers

	header('Content-Type: text/xml');

	header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');

	header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

	header('Pragma: public');



	echo '<?xml version="1.0" encoding="' . charset . '"?>' . "\r\n";

		echo '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">' . "\r\n";

	echo '<rss version="0.91">' . "\r\n";

	echo '<channel>';

	echo "\t<title>" . $_sitename . "</title>\r\n";

	echo "\t<link>".$_siteUrl."</link>\r\n";

	echo "\t<description>" . $_siteDescription . "</description>\r\n";

	echo "	<language>en-us</language>\r\n\r\n";

	echo "</channel>\r\n";

	echo "</rss>";

}

?>
Return current item: Arab Cart