david 12 anos atrás
pai
commit
e9e1e5d158
1 arquivos alterados com 13 adições e 41 exclusões
  1. 13 41
      listaprod.php

+ 13 - 41
listaprod.php

@@ -16,55 +16,27 @@ $statement->execute();
 $statement->store_result();
 $statement->bind_result($nombre,$desc,$descripcion);
 $count=$statement->num_rows;
-/*        var productos = [] ;
-        $.each(prod, function(i, item) {
-            var proddiv = $('<div/>', {
-                class: 'producto',
-                html:   item['html']
-            });
-            var img = "Images/producto.jpg";
-            productos.push(proddiv);
-        });
-        
-        
-        var lista_prod  = $('<div/>', {
-            id: 'lista_productos',
-            html: productos
-        });
-        var pagina = $('<div/>', {
-            id: 0, //incrementar
-            class: 'pagina',
-            html: lista_prod
-        });
-*/
 $i=0;
 $pag=0;
 
 while ( $statement->fetch() ) {
-    if (($i-1) % 6 && $i > 2 || $i == 0) {
+    $i++;
+    if (($i-1) % 6 == 0  && $i > 1 || $i == 1) {
         echo "<div class='pagina' id='pagina-$pag'>\n";
         $pag++;
     }
-	if(($i-1) % 2 && $i > 2 || $i == 0){
-			echo "<div class='listaproductos'>\n";
-	}
-	$html ="<div class='imagen'>
-                <img src='Images/producto.jpg'>
-            </div>
-            <div class='texto'>
-                <h5>$nombre</h5><br>$desc<br><br><u>Ver más</u>
-            </div>";
+	if(($i-1) % 2 == 0){ echo "<div class='listaproductos'>\n"; }
+	$html ="<div class='producto'>
+                <div class='imagen'>
+                    <img src='Images/producto.jpg'>
+                </div>
+                <div class='texto'>
+                    <h5>$nombre</h5><br>$desc<br><br><u>Ver más</u>
+                </div>
+           </div>";
     echo $html;
-	if($i % 2)
-	{
-		echo "</div>";
-	}
-	
-    if ($i % 6) {
-        echo "</div>"; //pagina
-        //echo "</div>"; //listaprod
-    }
-    $i++;
+	if($i % 2 == 0) { echo "</div>"; } # listaproductos
+    if($i % 6 == 0) { echo "</div>"; } #pagina 
 }
 ?>