tengo todo organizado en una tabla, y en otra celda tengo el menu con <? include('menu.php');?>
Código PHP:
<?php
require("inc/config.php");
if (!isset($pg))
$pg = 0; // $pg es la pagina actual
$cantidad=20; // cantidad de resultados por página
$inicial = $pg * $cantidad;
$pegar = "SELECT * FROM $tabla WHERE categoria = '$cate' ORDER BY id LIMIT $inicial,$cantidad";
$cad = mysql_db_query("$base_dato",$pegar);
$contar = "SELECT * FROM $tabla WHERE categoria = '$cate' ORDER BY id";
$contarok= mysql_db_query($base_dato,$contar);
$total_records = mysql_num_rows($contarok);
$pages = intval($total_records / $cantidad);
$p=strtoupper($cate);
echo "<table width=\"450\" border=\"0\" cellspacing=\"4\" cellpadding=\"4\">";
echo "<tr><td'><font class='tex_menu'><b>LISTADO DE $p </b></font><font class='tex_grisch'>- Actualmente hay $total_records $cate </td></tr>";
while($array = mysql_fetch_array($cad)) {
echo $_GET['$cat'];
$precio = trim(number_format($array['precio'], 0, ',', '.'));
$foto=trim($array['foto']);
if (empty($foto)) {
$foto='sinfoto.gif';}
echo "<tr><td><a href='detalle_propiedad.php?id=$array[id]'><img src='fotos/$foto' align='left' width='100' height='80' border='0'></a><font class='tex_marron1'>Tipo:<b>$array[tipo]</b><br>Ubicación: <b>$array[ubicacion]</b><br>Precio:<b>$precio $SITE_moneda</b><br><img src='imagenes/cuadraditomas.gif'> <a class='tex_menu' href='detalle_propiedad.php?id=$array[id]'>ver detalles</a></b></font></td></tr>";
}
echo "</table>";
echo "<p>";
if ($total_records=="0"){
echo "<font class='tex_menu'><b>En este momento no hay ".$cate." public.</b><br><br><br></font>";
}
if ($pg <> 0)
{
$url = $pg - 1;
echo "<font class='tex_grisch'><a class='tex_grisch' href='categoria.php?cate=".$cate."&pg=".$url."'>« Anterior</a></font> ";
}
else {
echo " ";
}
for ($i = 0; $i<($pages + 1); $i++) {
if ($i == $pg) {
if ($pg=='0'){
echo "<font class='pie_abajo'> </font>";
}
else {
echo "<font class='tex_menu'>$i </font>";
}
}
else {
echo "<font class='tex_grisch'><a class='tex_grisch' href='categoria.php?cate=".$cate."&pg=".$i."'>".$i."</a></font> ";
}
}
if ($pg < $pages) {
$url = $pg + 1;
echo "<font class='tex_grisch'><a class='tex_grisch' href='categoria.php?cate=".$cate."&pg=".$url."'>Siguiente »</a></font>";
}
else {
echo " ";
}
echo "</p>";
echo "<font class='tex_grisch'>Número de registros encontrados: " . $total_records . "<br></font>";
//echo "<font class='tex_grisch'>Páginas de " . $cantidad . " registros cada una<br></font>";
?>