web modular y paginacion

Iniciado por soru13, 5 Agosto 2010, 03:57 AM

0 Miembros y 2 Visitantes están viendo este tema.

soru13

hola,resulta que yo tengo mi web de forma modular con includes de esta forma:

Código (php) [Seleccionar]
<?
switch ($_GET["sección"]){
 case 'categorias';
   $incluir = 'categorias.php';
   $titulo = 'Categorías de los videos';
   break;
case 'aviso_legal';
   $incluir = 'aviso_legal.php';
   $titulo = 'Aviso legal';
   break;
 case 'rubias';
   $incluir = 'rubias.php';
   $titulo = 'Rubias';
   break;

 default:

   $incluir = 'lista.php';
   $titulo = 'Tu página de videos porno en español';
}
?>


y por ejemplo el código de la página rubias.php es el siguiente:

Código (php) [Seleccionar]
<?php 
 
$link 
= @mysql_connect("localhost""user""pass"); 
mysql_select_db("bd"$link); 
 
// maximo por pagina 
$limit 35
 
// pagina pedida 
$pag = (int) $_GET["pag"]; 
if (
$pag 1

   
$pag 1

$offset = ($pag-1) * $limit
 
 
$sql "SELECT SQL_CALC_FOUND_ROWS img, nombre, dur, id FROM videos where cat='Rubias' or cat2='Rubias' order by id desc LIMIT $offset$limit"
$sqlTotal "SELECT FOUND_ROWS() as total"
 
$rs mysql_query($sql); 
$rsTotal mysql_query($sqlTotal); 
 
$rowTotal mysql_fetch_assoc($rsTotal); 
// Total de registros sin limit 
$total $rowTotal["total"]; 
?>



     
<?php 
         
while ($row mysql_fetch_assoc($rs)) 
         { 
            
$name $row["img"]; 
$id $row["nombre"]."";
$dura $row["dur"]."";  
$url $row["id"];
         
?>

<div style="float: left;">
<?php 

echo "<table align=center border=0 width=80%>";
echo 
"<tr width=100%><td align=center width=180 height=135><a href='video.php?id=$url'><img height='135' width='180' src='".$name."'/></a></td></tr>";
echo 
"<tr  width=100%><td align=center width=180 height=50><b><a href='video.php?id=$url'>".$id."</a></b></td></tr>"
echo 
"<tr  width=100%><td align=center><font size='-2'>".$dura."</font></td></tr>"
echo 
"</table>";
?>
</div>

       
<?php 
         

      
?>

<div style="clear: both;">

   <br><br><p align="center">  
<?php 
         $totalPag 
ceil($total/$limit); 
         
$links = array(); 
         for( 
$i=1$i<=$totalPag $i++) 
         { 
            
$links[] = "<a href=\"?pag=$i\">$i</a>";  
         } 
         echo 
implode(" - "$links); 
      
?>


el caso es que si entras en la web directamente al archivo rubias.php la paginación funciona perfectamente pero si entras como index.php?sección=rubias, muestra la página pero la paginación de la página rubias.php que incluye no funciona,porque? como lo soluciono? gracias

mokoMonster

#1
 .
"Se necesitaron unos instantes para cortarle la cabeza, pero se necesitara un siglo para producir otra igual."
Lagrange


Shell Root

Nisiquiera veo donde realizas el include xD
Por eso no duermo, por si tras mi ventana hay un cuervo. Cuelgo de hilos sueltos sabiendo que hay veneno en el aire.

Ari Slash


soru13

el include está bien,lo que pasa que no es esa parte del código

el include lo pongo en el html asi:
Código (php) [Seleccionar]
<? include $incluir; ?>

Shell Root

Gran error, HTML no interpreta PHP.
Por eso no duermo, por si tras mi ventana hay un cuervo. Cuelgo de hilos sueltos sabiendo que hay veneno en el aire.

soru13

creo que no me entendiste,el codigo del index es el siguiente:

Código (php) [Seleccionar]
<?
switch ($_GET["sección"]){
  case 'categorias';
    $incluir = 'categorias.php';
$descripcion = 'Los videos porno están clasificados por categorías: Amateur,Anal,Asiáticas,Mamadas,Rubias,Morenas,Jovencitas,Lesbianas,Maduritas,Masturbación,Famosas,Interracial,Pilladas,Hardcore,Squirting y Otras';
    $titulo = 'Categorías de los videos';
    break;
  case 'pornstars';
    $incluir = 'pornstars.php';
$descripcion = 'Listado de Pornstars disponibles en la web con sus videos correspondientes.';
    $titulo = 'Pornstars';
    break;
  case 'top50';
    $incluir = 'top50.php';
$descripcion = 'Los 50 videos porno más vistos de la página web.';
    $titulo = 'Top 50 videos más vistos';
    break;
  case 'top50dura';
    $incluir = 'top50duracion.php';
$descripcion = 'Los 50 videos porno más largos de la página web.';
    $titulo = 'Los 50 videos más largos';
    break;
  case 'amateur';
    $incluir = 'amateur.php';
$descripcion = 'Mostrando todos los videos porno AMATEUR disponibles en la página web.';
    $titulo = 'Amateur';
    break;
  case 'anal';
    $incluir = 'anal.php';
$descripcion = 'Mostrando todos los videos porno ANAL disponibles en la página web.';
    $titulo = 'Anal';
    break;
  case 'asiaticas';
    $incluir = 'asiaticas.php';
$descripcion = 'Mostrando todos los videos porno de ASIÁTICAS disponibles en la página web.';
    $titulo = 'Asiáticas';
    break;
  case 'mamadas';
    $incluir = 'mamadas.php';
$descripcion = 'Mostrando todos los videos porno de MAMADAS disponibles en la página web.';
    $titulo = 'Mamadas';
    break;
  case 'rubias';
    $incluir = 'rubias.php';
$descripcion = 'Mostrando todos los videos porno de RUBIAS disponibles en la página web.';
    $titulo = 'Rubias';
    break;
case 'morenas';
    $incluir = 'morenas.php';
$descripcion = 'Mostrando todos los videos porno de MORENAS disponibles en la página web.';
    $titulo = 'Morenas';
    break;
case 'lesbianas';
    $incluir = 'lesbianas.php';
$descripcion = 'Mostrando todos los videos porno de LESBIANAS disponibles en la página web.';
    $titulo = 'Lesbianas';
    break;
case 'maduritas';
    $incluir = 'maduritas.php';
$descripcion = 'Mostrando todos los videos porno de MADURITAS disponibles en la página web.';
    $titulo = 'Maduritas';
    break;
case 'masturbacion';
    $incluir = 'masturbacion.php';
$descripcion = 'Mostrando todos los videos porno de MASTURBACIÓN disponibles en la página web.';
    $titulo = 'Masturbación';
    break;
case 'famosas';
    $incluir = 'famosas.php';
$descripcion = 'Mostrando todos los videos porno de FAMOSAS disponibles en la página web.';
    $titulo = 'Famosas';
    break;
case 'interracial';
    $incluir = 'interracial.php';
$descripcion = 'Mostrando todos los videos porno INTERRACIALES disponibles en la página web.';
    $titulo = 'Interracial';
    break;
case 'pilladas';
    $incluir = 'pilladas.php';
$descripcion = 'Mostrando todos los videos porno de PILLADAS disponibles en la página web.';
    $titulo = 'Pilladas';
    break;
case 'hardcore';
    $incluir = 'hardcore.php';
$descripcion = 'Mostrando todos los videos porno HARDCORE disponibles en la página web.';
    $titulo = 'Hardcore';
    break;
case 'squirting';
    $incluir = 'squirting.php';
$descripcion = 'Mostrando todos los videos porno de SQUIRTING disponibles en la página web.';
    $titulo = 'Squirting';
    break;
case 'otros';
    $incluir = 'otra.php';
$descripcion = 'Mostrando todos los videos porno que no encajan en las demás categorías.';
    $titulo = 'Otros';
    break;
case 'orgias';
    $incluir = 'orgias.php';
$descripcion = 'Mostrando todos los videos porno de ORGÍAS disponibles en la página web.';
    $titulo = 'Orgías';
    break;
case 'jovencitas';
    $incluir = 'jovencitas.php';
$descripcion = 'Mostrando todos los videos porno de JOVENCITAS disponibles en la página web.';
    $titulo = 'Jovencitas';
    break;
case 'espanolas';
    $incluir = 'espanolas.php';
$descripcion = 'Mostrando todos los videos porno de ESPAÑOLAS y en CASTELLANO disponibles en la página web.';
    $titulo = 'Españolas - Videos porno en CASTELLANO';
    break;
case 'krystalsteal';
    $incluir = 'pornstars/krystalsteal.php';
$descripcion = 'Mostrando todos los videos porno de la pornstar Krystal Steal disponibles en la página web.';
    $titulo = 'Videos porno de Krystal Steal';
    break;
case 'rebeca_linares';
    $incluir = 'pornstars/rebeca_linares.php';
$descripcion = 'Mostrando todos los videos porno de la pornstar Rebeca Linares disponibles en la página web.';
    $titulo = 'Videos porno de Rebeca Linares';
    break;
case 'lela_stars';
    $incluir = 'pornstars/lela_stars.php';
$descripcion = 'Mostrando todos los videos porno de la pornstar Lela Stars disponibles en la página web.';
    $titulo = 'Videos porno de Lela Stars';
    break;
case 'jenaveve_jolie';
    $incluir = 'pornstars/jenaveve_jolie.php';
$descripcion = 'Mostrando todos los videos porno de la pornstar Jenaveve Jolie disponibles en la página web.';
    $titulo = 'Videos porno de Jenaveve Jolie';
    break;
case 'alexis_texas';
    $incluir = 'pornstars/alexis_texas.php';
$descripcion = 'Mostrando todos los videos porno de la pornstar Alexis Texas disponibles en la página web.';
    $titulo = 'Videos porno de Alexis Texas';
    break;
case 'aviso_legal';
    $incluir = 'aviso_legal.php';
$descripcion = 'Aviso legal sobre la página web.';
    $titulo = 'Aviso legal';
    break;
  // Haremos tentos casos cómo páginas
  // tenga nuestra web

  default:

  // Este es el caso que mostrará el indice
  // funcionara si no se da ninguno de los
  // casos anteriores

    $incluir = 'lista.php';
    $titulo = 'Tu página de videos porno en español';
$descripcion = 'Videos porno online en Español y gratis.Organizados por categorías y pornstars.';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tupixxx.com - <? echo $titulo; ?></title>
<meta name="description" content="<? echo $descripcion; ?>" />
<meta name="keywords" content="porno,videos,películas,online,streaming,español,castellano,gratis,sexo,amateur,anal,asiáticas,mamadas,rubias,morenas,lesbianas,orgías,jovencitas,maduritas,masturbación,famosos,interracial,pornstars,españolas,pilladas,squirting,hardcore,otros,porn,sex,free." />
<link rel="shortcut icon" href="http://www.tupixxx.com/fav.ico"/>
<style type="text/css">
body p strong {
font-size: 36px;
font-family:Arial, Helvetica, sans-serif;
}
body {
background-color: #FCF;
}
body,td,th {
color: #000;
font-size: 12px;
font-family: Verdana, Geneva, sans-serif;
}
a:link {
color: #000;
text-decoration: none;
}
a:visited {
color: #000;
text-decoration: none;
}
a:hover {
color: #000;
text-decoration: none;
}
a:active {
color: #000;
text-decoration: none;
font-size: 16px;
}
arriba {
margin-top:auto;
}
</style>
</head>

<body>
<table width="100%" border="0">
  <tr>
    <td>      <table width="80%" border="0" align="center">
      <tr>
        <td width="48%"><table width="99%" border="0">
          <tr>
            <td><img src="images/1225769858906691038rg1024_o.png" alt="" width="385" height="73" border="0" usemap="#Map" />
              <map name="Map" id="Map">
                <area shape="rect" coords="5,3,377,69" href="inicio.html" />
                </map></td>
          </tr>
        </table></td>
        <td width="52%"><table width="99%" border="0">
              <tr>
                <td>&nbsp;</td>
                <td width="26%" rowspan="3"><!-- AddThis Button BEGIN -->
                <!-- AddThis Button END --><img src="images/cerdo.jpg" width="164" height="137" /></td>
              </tr>
              <tr>
            <td width="74%">Tu página de videos porno en <b>Español</b>.</td>
            </tr>
          <tr>
            <td>      <FORM method=GET action="http://www.google.com/search"><INPUT TYPE=text name=q size=31 maxlength=255 value="">
              <INPUT type=submit name=btnG VALUE="Buscar">
              <font size=-1>
              <input type=hidden name=domains value="tupixxx.com"><br>Buscar en: <input type=radio name=sitesearch value="">
              Google
              <input type=radio name=sitesearch value="tupixxx.com" checked> <b>Tupixxx.com</b><br>
              <input type=hidden name=ie value=UTF-8>
  <input type=hidden name=oe value=UTF-8></FORM>
              </font>&nbsp;</td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td colspan="2" background="images/fondomenu.png" height="42"><table width="100%" border="0" height="44" bordercolor="#FF99FF">
          <tr align="center" bordercolor="#FF99FF">
            <td width="10%" onmouseover='this.style.background="#DB00AF"'  onmouseout='this.style.background=""'><a href="inicio.html"><font size="3">Inicio</font></a></td>
            <td width="14%" onmouseover='this.style.background="#DB00AF"'  onmouseout='this.style.background=""'><font size="3"><a href="categorias.html">Categorías</a></font></td>
            <td width="13%" onmouseover='this.style.background="#DB00AF"'  onmouseout='this.style.background=""'><font size="3"><a href="pornstars.html">Pornstars</a></font></td>
            <td width="13%" onmouseover='this.style.background="#DB00AF"'  onmouseout='this.style.background=""'><font size="3"><a href="top_50_videos_mas_vistos.html">Top videos</a></font></td>
            <td width="16%" onmouseover='this.style.background="#DB00AF"'  onmouseout='this.style.background=""'><font size="3"></font><font size="3"><a href="enviar_video.php" target="_blank" onclick="window.open(this.href, this.target, 'width=600,height=400,scrollbars=yes' ); return false;">Enviar video</a></font></td><td width="17%">&nbsp;</td>
            <td width="17%"><a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;username=tupixxx"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a>
          <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=tupixxx"></script></font></a></td>
            </tr>
          </table></td>
      </tr>
    </table>
      <table width="80%" border="0" align="center">
        <tr>
          <td width="22%">&nbsp;</td>
          <td width="18%">&nbsp;</td>
          <td width="38%">&nbsp;</td>
          <td width="22%">&nbsp;</td>
        </tr>
        <tr>
          <td height="30" colspan="4" background="images/cuadradofondo.png"><table width="100%" border="0">
            <tr>
              <td width="40%"><font size="3">&nbsp;<b><? echo $titulo; ?></b></font></td>
              <td width="4%">&nbsp;</td>
              <td width="56%" align="right"><a href="ver_videos.html"><font size="3">Ver los
                <?php
   
include ("config.php");
    
// primero conectamos siempre a la base de datos mysql
    
$sql "SELECT * FROM videos";  // sentencia sql
   
$result mysql_query($sql);
   
$numero mysql_num_rows($result); // obtenemos el número de filas
    
echo $numero;  // imprimos en pantalla el número generado
      
?>

                videos gratis</td>
              </tr>
            </table>
            </td>
        </tr>
        <tr>
          <td height="30" colspan="4" align="center" class="arriba"><? include $incluir; ?></td>
        </tr>
        <tr>
          <td height="30" colspan="4" background="images/cuadradofondo.png"><font size="3"><b>&nbsp;Categorías</b> - Pincha en una categoría para ver los videos que contiene</font></td>
        </tr>
        <tr>
          <td height="30" colspan="4" align="center"><br />           
          <a href="amateur.html">Amateur</a> - <a href="anal.html">Anal</a> - <a href="asiaticas.html">Asiáticas</a> - <a href="mamadas.html">Mamadas</a> - <a href="rubias.html">Rubias</a> - <a href="morenas.html">Morenas</a> - <a href="lesbianas.html">Lesbianas</a> - <a href="orgias.html">Orgías</a> - <a href="jovencitas.html">Jovencitas</a> - <a href="maduritas.html">Maduritas</a> - <a href="masturbacion.html">Masturbación</a> - <a href="famosas.html">Famosas</a> - <a href="interracial.html">Interracial</a> - <a href="pornstars.html">Pornstars - <a href="espanolas.html">Españolas</a> - <a href="pilladas.html">Pilladas</a>  - <a href="squirting.html">Squirting</a> - <a href="hardcore.html">Hardcore</a> - <a href="otros.html">Otros</a><br /><br /></td>
        </tr>
        <tr>
          <td height="10" colspan="4" align="center"><img src="images/lineafinal.png" width="800" height="2" /></td>
        </tr>
        <tr>
          <td height="30" colspan="4" align="center"><p><a href="contacto.php" target="_blank" onClick="window.open(this.href, this.target, 'width=600,height=400,scrollbars=yes' ); return false;">Contacta con nosotros</a> | <a href="aviso_legal.html">Aviso legal</a> | Copiright Tupixxx.com 2010</p>
          <p><img src="images/badge_php.gif" width="80" height="15" />&nbsp;<img src="images/button-mysql.png.jpg" width="80" height="15" />&nbsp;<img src="images/css_powered.png" width="80" height="15" />&nbsp;<img src="images/firefox.gif" width="80" height="15" border="0" usemap="#Map2" />&nbsp;<a href=http://www.ademails.com/estadisticas1060002944.htm>
<script type="text/javascript" language="javascript">
<!--
document.write("<img src=\"http://www.ademails.com/cgi-bin/contador.cgi?ID=1060002944");
document.write("&referer=");
document.write(escape(document.referrer));
document.write("\" border=0 alt=\"Estadisticas\">");
// -->
</script><noscript><img src=http://www.ademails.com/cgi-bin/contador.cgi?ID=1060002944 alt="Estadisticas" height="15" border=0></noscript></a> </p></td>
        </tr>
    </table></td>
  </tr>
</table>
<map name="Map2" id="Map2">
  <area shape="rect" coords="0,2,80,14" href="http://www.mozilla-europe.org/es/" target="_blank" />
</map>
</body>
</html>


así es el index.php

Ari Slash

#8
intenta quitarle el tilde a la variable $_GET["sección"
y llamala por la url sin tilde

el archivo que se incluye debe estar en la misma carpeta que index.php

pd: no pruebo el codigo porque estas conectando a base de datos

pd2: en una zona de la pagina (no en los include) estas llamando a rubias.html no a rubias.php , pero es solo un link, nada relacionado con los include ni get
<a href="rubias.html">Rubias</a>

saludos