Справочная система
Проекты Live Internet | Page Index | Recent Changes | Recently Commented | Registration

<?
session_start();
include($DOCUMENT_ROOT."/inc/dbconnect.inc");


$today = date(«Y-m-d H:i»);


print '<?xml version="1.0" encoding="windows-1251"?>';
?>
<!DOCTYPE yml_catalog SYSTEM “shops.dtd”>
<yml_catalog date="<?=$today?>">


<shop>
<name>Дивайс Ком?</name>
<company>Дивайс Ком?</company>
<url>http://www.devicecom.ru/</url>


<currencies>
<?
$curr="SELECT * FROM course ORDER BY id DESC;";
$prod=mysql_query($curr,$link);
$arr_prod=mysql_fetch_array($prod);
?>

<currency id="RUR" rate="1"/>
<currency id="USD" rate="<? print $arr_prod['nal']; ?>"/>
<currency id="EUR" rate="CBRF" plus="3"/>

</currencies>
<categories>
<?
$cat_list= array();
$ctg="SELECT * FROM meta WHERE yand=1";
$ctg=mysql_query($ctg,$link);
for($i=0;$i<mysql_num_rows($ctg);$i++)
{

$arr_ctg=mysql_fetch_array($ctg);
if(eregi("^[^\.]+\.(\ )+(.+)$",$arr_ctg['name'],$regs)) $name=$regs[2]; else $name=$arr_ctg['name'];
print " <category id=\.$arr_ctg['code']."\" parentId=\.$arr_ctg['parent_id']."\">".$name."</category>\n";
$cat_list[]=$arr_ctg['code'];

}
?>
</categories>


<offers>
<?
$prod="SELECT product.name,product.code,product.price1,product.parent_id,product.img,meta.code,meta.img,product.yand FROM product, meta WHERE (";
for($r=0;$r<count($cat_list);$r++)
{

$prod.="product.parent_id=".$cat_list[$r]." OR ";

}
$prod=substr($prod,0,(strlen($prod)-4));
$prod.=") AND meta.yand=1 AND product.yand=1 AND product.parent_id=meta.code;";
$prod=mysql_query($prod,$link);
if(mysql_num_rows($prod)>0)
{
for($k=0;$k<mysql_num_rows($prod);$k++)
{

$arr_prod=mysql_fetch_array($prod);

?>

<offer id="<?=$arr_prod[1]?>" available="false">
<url>http://www.devicecom.ru/prod/index.php?id=<?=$arr_prod[1]?></url>
<price><?

$arr_prod['price1']=ereg_replace(",",".",$arr_prod['price1']);
$arr_prod['price1']=ereg_replace(" ",,$arr_prod['price1']);
print $arr_prod['price1'];
?></price>
<currencyId>USD</currencyId>
<categoryId><?=$arr_prod[3]?></categoryId>
<?
if($arr_prod[4]!=)
{
?><picture>http://www.devicecom.ru/img/upload/<?=$arr_prod[4]?></picture>
<?
}
elseif($arr_prod[4]== && $arr_prod[6]!=)
{
?><picture>http://www.devicecom.ru/img/upload/<?=$arr_prod[6]?></picture>
<?
}
?><name><?
$arr_prod[0]=ereg_replace("\"",""",$arr_prod[0]);
$arr_prod[0]=ereg_replace("&","&",$arr_prod[0]);
$arr_prod[0]=ereg_replace(">",">",$arr_prod[0]);
$arr_prod[0]=ereg_replace("<","<",$arr_prod[0]);
$arr_prod[0]=ereg_replace("\'","'",$arr_prod[0]);

print $arr_prod[0];
?></name>
<description><?=$arr_prod[0]?></description>
</offer>

<?
}
}
?>
</offers>
</shop>
</yml_catalog>


 
Файлы [Скрыть файлы/форму]
Время работы: 0.141 s
Использовано памяти: 2.267 Mb