18/07/2008, 14:16
|
| | | Fecha de Ingreso: agosto-2007 Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses Puntos: 28 | |
Respuesta: Problemas con galeria horizontal y vertical Resuelto... Código PHP: <?php require_once('admin/Connections/orocauchos.php'); ?> <?php include('conect.php'); $currentPage = $_SERVER["PHP_SELF"]; $n_filas=3; $maxRows_Recordset1 = 6; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; mysql_select_db($database_orocauchos, $orocauchos); $query_Recordset1 = "SELECT * FROM productos"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $orocauchos) or die(mysql_error()); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $queryString_Recordset1 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Recordset1") == false && stristr($param, "totalRows_Recordset1") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1); $cat=8; $fotos = array(); $sql="SELECT * FROM productos ORDER BY id ASC"; mysql_select_db ('conect'); $sql_exec=mysql_query($sql); $tottal=113; // ------------------------------------------------------------------------------------------------------------------ $vert=$tottal/$n_filas; $vert=round($vert); /*function npad($num, $max = 0) { return str_pad($num, $max, '0', STR_PAD_LEFT); } */ ?> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <?php $a=0;// Colocando el contador horizontal en 0 $i=1;// Colocando el contador vertical en 0 $w=0;//Colocando un contador para el mensaje de "No hay articulos en esta acategoria" while($row_Recordset1=mysql_fetch_assoc($Recordset1)){ $w=w+1; if ($a==0){ echo '<tr>'; } $a=$a+1; $fotos[$i.'-'.$a] = $row['imagen']; $num= $num + 1; echo "<td align='center' valign='top'> <table width='200' border='0' cellspacing='0' cellpadding='0'> <tr> <td height='151' align='center' valign='middle' bgcolor='#E4E4E4'><table width='150' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td><img src='imgprod/".$row_Recordset1['imagen']."' width='150' height='101'/></td> </tr> </table></td> </tr> <tr> <td><span class='textoTitulos2'>".$row_Recordset1['nombre']."</span></td> </tr> </table></br> </td> "; $r=$a;// contador remanente para listar imagenes sin exceso if ($a >= $n_filas) { $a=0;// reiniciando el contador horizontal $i=$i+1;// aumentando el contador vertical echo '</tr><td></td>'; } if (empty($row_Recordset1)) { echo" texto de que no hay "; break 1;} } ?> </table> <table border="0" width="50%" align="center"> <tr class="Estilo6"> <td width="23%" align="center"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">Primero</a> <?php } // Show if not first page ?> </td> <td width="31%" align="center"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Anterior</a> <?php } // Show if not first page ?> </td> <td width="23%" align="center"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Siguiente</a> <?php } // Show if not last page ?> </td> <td width="23%" align="center"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Último</a> <?php } // Show if not last page ?> </td> </tr> </table> <div align="left"><span class="textoTitulos2">Registros </span><span class="textoRojo"><?php echo ($startRow_Recordset1 + 1) ?></span><span class="textoTitulos2"> a </span><span class="textoRojo"><?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?></span><span class="textoTitulos2"> de</span> <span class="textoRojo"><?php echo $totalRows_Recordset1 ?></span></div> <?php mysql_free_result($Recordset1); ?>
__________________ Diseño gráfico, Web, imagen corporativa, publicidad ... |