Código:
<catalog> − <product> <id>48</id> <title>Boltrona Single Seater - Leather</title> − <description> texto desription </description> <price> 1185 </price> − <thumbimg> www .kmpfurniture.com/admin/uploads/BoltronasingleseaterleatherThumbnail.jpg </thumbimg> <collection>Fire</collection> <category>leather sofas fabric sofas</category> </product> </catalog>
La interpretacion con php y simpleXML .. ojo el codigo corre sobre php5
Código PHP:
<center>
<?php
$xml = simplexml_load_file("kmpfurniture .com / feeds/kmpfurniture_catalog2 . xml"); ?>
<table border="0" >
<tr>
<td colspan="5" align="center" style="font-size:50px; color:#993300; font-family:Arial;" >
JUST FIRE
</td>
</tr>
<tr>
<td colspan="5" align="left">Share this page: <a href="facebook.com/share.php?u=olympus-tours.com/kmpfurniture_catalog . php"><img src="esp .kmpfurniture.com/Ads/images/win-cancun-trip_15. jpg" alt="Facebook" width="24" height="25" border="0"></a> <br />
KMP Furniture store is committed to exceed your expectations of quality and good service, with a variety of Contemporary and Modern Furniture.
</td>
</tr>
<tr>
<?
$cont=0;
foreach($xml->product as $product)
{ //foreach ?>
<?
if ($cont % 5 == 0) //Este es un break para hacer el salto en la tabla cada 5 productos
{echo "<tr>";} // imprimo un tr cuando el $con del producto es multiplo de 5
//if($cont==(string)$product->collection == "Fire"){ echo"<tr>" }
if((string)$product->collection == "Fire") // pregunto si ese producto es de la coleccion Fire
{ //ifB ?>
<td align="center" style="padding:3px 3px 3px 3px" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="180px" style="border:1px solid #666666">
<tr>
<th height="44px" valign="middle" align="center" style="padding:0 2px 0px 2px;">
<?
printf("%s\n", $product->title);
?>
</th>
</tr>
<tr>
<th>
<?
echo "<img src='";
printf($product->thumbimg);
echo "' width='170px' height='139px'/>" ;
?>
</th>
</tr>
<tr>
<th>
<form target="paypal" action="paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="66UQTPVMTW3D4">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value='<? printf("%s\n", $product->title);?>'>
<input type="hidden" name="item_number" value='<? printf("%s\n", $product->id);?>'>
<input type="hidden" name="amount" value=' <? printf("%s\n", $product->price);?>'>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_SM.gif:NonHosted">
<input type="image" src="paypal.com/en_US/i/btn/btn_cart_SM.gif"
border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="paypal.com/es_XC/i/scr/pixel.gif" width="1" height="1">
</form>
</th>
<tr>
<th>
<?
printf("Price: $ %s\n ", $product->price);
?>
</th>
<tr>
<!--<th>
<?
/*printf("Collection: %s\n ", $product->collection);*/ //imprime una celda mas y la coleccion
$cont = $cont+1;
?>
</th>-->
</tr>
</table>
<?
}//ifB
?>
</td>
<?
} //foreach ?>
</tr>
</table>
</center>
Código:
NuevosMillonariosEnInternet.com/kmpfurniture_catalog.php