|
freebee
2012-01-18 22:10:48
Votes: 0
|

Hi, i dont use any plugin - i generate it by only php skript:
<?php $myURL = "http://eshop.eko-light.cz/"; // je treba zmenit na Vasi adresu $file = file("./db/cz_products.php"); $fileIMG = file("./db/cz_products_files.php"); $myURLIMG = "".$myURL."files/";
function change2Latin( $sContent ){ return str_replace( Array( '¶', '±', '¼', '¿', 'ê', '³', 'ó', 'æ', 'ñ', '¦', '¡', '¬', '¯', 'Ê', '£', 'Ó', 'Æ', 'Ñ', 'á', 'è', 'ï', 'é', 'ì', 'í', 'ò', 'ø', '±', '»', 'ú', 'ù', 'ý', '¾', 'Á', 'È', 'Ï', 'É', 'Ì', 'Í', 'Ò', 'Ø', '©', '«', 'Ú', 'Ù', 'Ý', '®', 'ä', 'µ', 'å', 'à', 'Ä', '¡', 'Å', 'À', 'ö', 'ü', 'ß', 'Ö', 'Ü' ), Array( 's', 'a', 'z', 'z', 'e', 'l', 'o', 'c', 'n', 'S', 'A', 'Z', 'Z', 'E', 'L', 'O', 'C', 'N', 'a', 'c', 'd', 'e', 'e', 'i', 'n', 'r', 's', 't', 'u', 'u', 'y', 'z', 'A', 'C', 'D', 'E', 'E', 'I', 'N', 'R', 'S', 'T', 'U', 'U', 'Y', 'Z', 'a', 'l', 'l', 'r', 'A', 'L', 'L', 'R', 'o', 'u', 'S', 'O', 'U' ), $sContent ); } // end function change2Latin
function change2Url( $sContent ){ return strtolower( change2Latin( str_replace( Array( ' ', '»', '/', '$', '\'', '"', '~', '\\', '?', '#', '%', '+', '^', '*', '>', '<', '@', '|', '"', '%', ':', '&', ',', '=', '--', '--', '[', ']', 'λ', '´', ' ' ), Array( '-', '', '-', '-', '', '', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '', '-', '-', '-', '-', '(', ')', '', '-', '' ), trim( $sContent ) ) ) ); } // end function change2Url
function trimTags($input, $validTags = '') { $regex = '#\s*<(/?\w+)\s+(?:on\w+\s*=\s*(["\'\s])?.+? \(\1?.+?\1?\);?\1?|style=["\'].+?["\'])\s*>#is'; return preg_replace($regex, '<${1}>',strip_tags($input, $validTags)); }
$txt = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"."\n"; $txt .= "<shop>"."\n";
$i=0; foreach($fileIMG as $dataIMG) { $temp = explode("$",$dataIMG); $ImgID[i] = $temp[1]; $ImgName[$ImgID[i]] = $temp[2]; $i++; }
$i=0; foreach($file as $data) { list($iPosition, $sName, $sPrice, $sAvailable, $iProduct, $iStatus, $sDescriptionShort) = explode("$",$data); if ($i>0) { //kompletace adresy, pri vyuziti mod-rewrite //staci odstranit ty dve zavorky o radek nize //$myFinalURL = $myURL.$iPosition.",".change2Url( $sName ).".html"; //adresa, bez modu $myFinalURL = $myURL."?".$iPosition.",".change2Url( $sName ); $myFinalURLIMG = $myURLIMG.$ImgName[$iPosition];
//uprava popisu $sDescriptionShort = str_replace("|n|", " ", $sDescriptionShort); $sDescriptionShort = trimTags($sDescriptionShort); $txt .= "<SHOPITEM>"."\n"; $txt .= "<PRODUCT>$sName</PRODUCT>"."\n"; $txt .= "<DESCRIPTION>$sDescriptionShort</DESCRIPTION>"."\n"; $txt .= "<URL>$myFinalURL</URL>"."\n"; $txt .= "<IMGURL>$myFinalURLIMG</IMGURL>"."\n"; $txt .= "<PRICE_VAT>$sPrice</PRICE_VAT>"."\n"; $txt .= "<ITEM_TYPE>new</ITEM_TYPE>"."\n"; $txt .= "<AVAILABILITY>0</AVAILABILITY>"."\n"; $txt .= "</SHOPITEM>"."\n"; } $i++; };
$txt .= "</shop>"."\n";
//vypis hodnot echo $txt; ?>
Thanks DAvid
-------------------------------------------------------
DAvid
|