Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/02/2012, 13:39
Avatar de repara2
repara2
 
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: Catalogo de productos

Código PHP:
Ver original
  1. $productos = array();
  2. $productos = array(
  3. 1 => 'Producto 1',
  4. 2 => 'Producto 2',
  5. 3 => 'Producto 3',
  6. 4 => 'Producto 4',
  7. 5 => 'Producto 5',
  8. 6 => 'Producto 6',
  9. 7 => 'Producto 7',
  10. 8 => 'Producto 8',
  11. 9 => 'Producto 9',
  12. 10 => 'Producto 10',
  13. 11 => 'Producto 11',
  14. 12 => 'Producto 12',
  15. 13 => 'Producto 13',
  16. 14 => 'Producto 14',
  17. 15 => 'Producto 15',
  18. 16 => 'Producto 16'
  19. );
  20.  
  21. $table = "<table border='0' align='center' cellspacing='0' cellpadding='0'>";
  22. $table .="<tr>";
  23.     $table .="<td bgcolor='Orange' colspan='3'>Catálogo de productos</td>";
  24.     $table .="</tr>";
  25. for($i=1;$i<count($productos);$i+=3)
  26. {
  27.  
  28.     $bgcolor = "bgcolor='".(4==$i%6?"Grey":"")."'";
  29.     $table .="<tr $bgcolor>";
  30.     $table .="<td>{$productos[$i]}</td><td>{$productos[$i+1]}</td><td>{$productos[$i+2]}</td>";
  31.     $table .="</tr>";
  32. }
  33. $table .="<tr>";
  34.     $table .="<td bgcolor='Orange' colspan='3'>&nbsp;</td>";
  35.     $table .="</tr>";
  36. $table .= "</table>";
  37. echo $table;
__________________
Fere libenter homines, id quod volunt, credunt.