|
|
@@ -1,11 +1,13 @@
|
|
|
-<?
|
|
|
+<?php
|
|
|
include('db.php');
|
|
|
|
|
|
-$statement = $db->prepare("SELECT `nombre` FROM `productos` WHERE `categoria` = ? limit 7");
|
|
|
+$statement = $db->prepare("SELECT `nombre`, `desc_corta` FROM `productos` WHERE `categoria` = ?");
|
|
|
$cat = 'FACIALES';
|
|
|
$statement->bind_param('s', $cat);
|
|
|
$statement->execute();
|
|
|
-$statement->bind_result($nombre);
|
|
|
+$statement->store_result();
|
|
|
+$statement->bind_result($nombre,$desc);
|
|
|
+$count=$statement->num_rows;
|
|
|
?>
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
<html>
|
|
|
@@ -16,7 +18,39 @@ $statement->bind_result($nombre);
|
|
|
<link type="text/css" rel="Stylesheet" href="Especificos.css" />
|
|
|
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
|
|
|
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
|
|
|
-<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
|
|
|
+<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
|
|
|
+<script>
|
|
|
+$(document).ready(function() {
|
|
|
+ curpag=1;
|
|
|
+ $(".next").click(function() {
|
|
|
+ if ( ! $(".pagina[num='"+(curpag+1)+"']").length )
|
|
|
+ return;
|
|
|
+ $(".pagina").hide();
|
|
|
+ curpag++;
|
|
|
+ $(".pagina[num='"+curpag+"']").show();
|
|
|
+ $("#paginas_list li").css("opacity",0.5);
|
|
|
+ $("#paginas_list li[num='"+curpag+"']").css("opacity",1);
|
|
|
+
|
|
|
+ });
|
|
|
+ $(".prev").click(function() {
|
|
|
+ $(".pagina[num='"+curpag+"']").hide();
|
|
|
+ curpag--;
|
|
|
+ if ( curpag < 1 )
|
|
|
+ curpag=1;
|
|
|
+ $(".pagina[num='"+curpag+"']").show();
|
|
|
+ $("#paginas_list li").css("opacity",0.5);
|
|
|
+ $("#paginas_list li[num='"+curpag+"']").css("opacity",1);
|
|
|
+ });
|
|
|
+ $("#paginas_list li").click(function() {
|
|
|
+ $("#paginas_list li").css("opacity",0.5);
|
|
|
+ $(this).css("opacity",1);
|
|
|
+ $(".pagina").hide();
|
|
|
+ $(".pagina[num='"+$(this).attr('num')+"']").show();
|
|
|
+ curpag=$(this).attr('num');
|
|
|
+ alert(curpag);
|
|
|
+ });
|
|
|
+});
|
|
|
+</script>
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
@@ -55,32 +89,31 @@ $statement->bind_result($nombre);
|
|
|
</div>
|
|
|
|
|
|
<div id ="paginas_wrapper">
|
|
|
- <?
|
|
|
+ <?php
|
|
|
$i=0;
|
|
|
- while($statement->fetch()){
|
|
|
+ $j=0;
|
|
|
+ while($j< (floor($count/3) + ($count % 3 != 0 ? 1 : 0) )){
|
|
|
+ $j++;
|
|
|
?>
|
|
|
- <div id="pagina">
|
|
|
+ <div num="<?php echo $j; ?>" class="pagina" <?php if ($j > 1) { echo 'style="display:none"'; } ?> >
|
|
|
<div class="nav" style="display: inline; float: left; height: 30px; margin-top: 170px;">
|
|
|
<label for="img-1" class="prev">‹</label>
|
|
|
</div>
|
|
|
<div id="lista_productos">
|
|
|
- <? while ($i<3) {
|
|
|
+ <?php while ($i<3 && $statement->fetch()) {
|
|
|
$i++;
|
|
|
?>
|
|
|
<div id="producto" style="float:left;">
|
|
|
- <div style="float : left;">
|
|
|
+ <div style="float : left; width:15%;">
|
|
|
<img src="Images/producto.jpg">
|
|
|
</div>
|
|
|
- <div style="float : left;">
|
|
|
- <h4> <? echo $nombre; ?> </h4>
|
|
|
- <br> blahblahlbahlbfdgracdmksla iaos fjdiosa f<br><br>
|
|
|
+ <div style="float : left; width: 74%;">
|
|
|
+ <h4> <?php echo $nombre; ?> </h4>
|
|
|
+ <br> <?php echo $desc; ?> <br><br>
|
|
|
<u>Ver más</u>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <?
|
|
|
- if (i!=3) {
|
|
|
- if (!$statement->fetch()) { break; }
|
|
|
- }
|
|
|
+ <?php
|
|
|
} //while $i %3 && st-fetch
|
|
|
$i=0;
|
|
|
?>
|
|
|
@@ -88,16 +121,22 @@ $statement->bind_result($nombre);
|
|
|
<div class="nav" style="float: right; height: 30px; margin-top: 170px;">
|
|
|
<label for="img-3" class="next">›</label>
|
|
|
</div>
|
|
|
- <ul id="paginas_list">
|
|
|
- <li> • </li>
|
|
|
- <li style="opacity: 0.5"> • </li>
|
|
|
- <li style="opacity: 0.5;"> • </li>
|
|
|
- </ul>
|
|
|
+
|
|
|
</div>
|
|
|
- <? } ?>
|
|
|
+ <?php } ?>
|
|
|
+ <ul id="paginas_list">
|
|
|
+ <?php
|
|
|
+ for ($i=1; $i<= $j; $i++) {
|
|
|
+ echo "<li num=$i style='opacity: " . ($i==1? "1.0" : "0.5") ."'> • </li>";
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </ul>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</body>
|
|
|
</html>
|
|
|
+<?php
|
|
|
+$statement->close();
|
|
|
+?>
|