Foros del Web » Programando para Internet » PHP »

problema con enlaces en includes

Estas en el tema de problema con enlaces en includes en el foro de PHP en Foros del Web. hola a todos explicaré el problema detalladamente (espero no dejarme nada) el caso es que tengo este codigo Código PHP: <? switch ( $ando ) {    case  ...
  #1 (permalink)  
Antiguo 30/06/2004, 04:53
Avatar de yeta  
Fecha de Ingreso: enero-2004
Mensajes: 148
Antigüedad: 20 años, 3 meses
Puntos: 0
problema con enlaces en includes

hola a todos
explicaré el problema detalladamente (espero no dejarme nada)
el caso es que tengo este codigo

Código PHP:
<?switch ($ando) {
   case 
archivo:
         include (
'archivo.php');
         break;
   case 
contactar:
         include (
'contactar.php');
         break;
   case 
info:
         include (
'info.php');
         break;
   case 
comentarios:
         include (
'comentarios.php');
         break;
   case 
fotos:
         include (
'fotos.php');
         break;
     default:
         include (
"inicio.php");
         break;
 }
?>
dentro de una pagina
todos los carga bien. el problema que tengo es con "fotos.php". resulta que eso es un album de fotos. lo que pasa que ese album de fotos está dividido en páginas que se crean automáticamente. pero al darle a por ejemplo Página 2, al ser un include, no se carga en el mismo sitio. me gustaría saber como hacer para que se cargase en el mismo lugar
me entendeis?
muchas gracias
  #2 (permalink)  
Antiguo 30/06/2004, 13:21
Ex Colaborador
 
Fecha de Ingreso: junio-2002
Mensajes: 9.091
Antigüedad: 21 años, 10 meses
Puntos: 16
Hola,

Los enlaces de la paginacion tendrian que apuntar a una URL como la que cargo la primera. COmo no pones como se generan los links de la paginacion, no se que mas decirte.

Saludos.
__________________
Josemi

Aprendiz de mucho, maestro de poco.
  #3 (permalink)  
Antiguo 30/06/2004, 13:38
Avatar de yeta  
Fecha de Ingreso: enero-2004
Mensajes: 148
Antigüedad: 20 años, 3 meses
Puntos: 0
lo siento no entendi lo que querias decirme...
te pongo todo el codigo, en el que esta incluido lo de la paginacion
(todo el script q hace el album no se compone solo de esto eh!!)
Código PHP:
<?php
function showImg($aPath$aFn$aThisPage)
{
  global 
$thumbwidth$showfilename;

  
$fullpath $aPath.$aFn;

  
// width and height
  
$imgsize GetImageSize($fullpath);
  
$twidth $thumbwidth;
  
$theight $imgsize[1] / ($imgsize[0]/$twidth);

  
// Thumbnails
  
echo "<td>";
  echo 
"<center><a href=$fullpath target=_blank><img border=\"0\" width=\"$twidth\" height=\"$theight\" src=\"create.php?image=$fullpath&w=$twidth\"></img></a></center>";
  if(
$showfilename) {
    
$l strlen($aFn) - 4;
    echo 
"<br><center>".substr($aFn0$l)."</center>";
  }
  echo 
"</td>";

}

function 
showDir($aPath$aFn)
{
  
$fullpath $aPath.$aFn;
  
$imgsize GetImageSize("folder.gif");
  echo 
"<td>";
  echo 
"<center><a href=\"fotos1.php?path=$fullpath/\"><img border=\"0\" width=\"$imgsize[0]\" height=\"$imgsize[1]\" src=\"folder.gif\"></img></a></center>";
  echo 
"<br><center>$aFn</center>";
  echo 
"</td>";

}

function 
showImgRow($aPath$aFiles$aIsDir$aThisPage$aStart$aEnd)
{
  echo 
"<tr>";
  for(
$i=$aStart$i<$aEnd$i++) {
    if(
$aIsDir[$i]) {
      
showDir($aPath$aFiles[$i]);
    } else {
      
showImg($aPath$aFiles[$i], $aThisPage);
    }
  }
  echo 
"</tr>";
}

function 
showImgTable($aPath$aFiles$aIsDir$aThisPage,
    
$aNumCols$aNumRows)
{
  
$numPerPage $aNumRows $aNumCols;
  
$totalFiles count($aFiles);
  
$start $aThisPage $numPerPage;
  
$end $start $numPerPage;
  
$end min($end$totalFiles);

  echo 
"<center>";
  echo 
"<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">";

  while(
$start $end) {
    
$e min($start $aNumCols$end);
    
showImgRow($aPath$aFiles$aIsDir$aThisPage$start$e);
    
$start += $aNumCols;
  }

  echo 
"</table>";
  echo 
"</center>";
}

function 
showPageLinks($aPath$aNumFiles$aThisPage$aImg$aNumCols$aNumRows)
{
  
$numPerPage $aNumCols $aNumRows;
  
$numPages ceil($aNumFiles $numPerPage);

  
/*
   * reverse finding '/' start from the second last char
   * since the last char must be '/'
   */
  
$pdir "";
  
$plen strlen($aPath);
  for(
$j=$plen-2$j>0$j--) {
    if(
$aPath[$j] == '/') {
      
$pdir substr($aPath0$j+1);
      break;
    }
  }

  echo 
"<br><center>";
  echo 
"<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">";
  echo 
"<tr>";
  if(
$aImg) {
    
// Showing big image
    
echo "<td><a href=\"fotos1.php?path=$aPath&page=$aThisPage\"> Go Back </a></td>";
  } else {
    
// show the up link
    
if($pdir != "") {
      echo 
"<td><a href=\"fotos1.php?path=$pdir\">UP</a></td>";
    }
    
// show the page links
    
if($numPages == 0) {
      echo 
"<td>No Images</td>";
    } else {
      
// show only 10 pages
      
$minp 0;
      
$maxp 10;
      if(
$numPages 10) {
        
$minp floor($aThisPage/10) * 10;
        
$maxp ceil(($aThisPage+1)/10) * 10;
      }
      
$maxp min($maxp$numPages);


      
// show the prev link
      
if($minp >= 10) {
        
$prevp $minp 1;
        echo 
"<td><a href=\"fotos1.php?path=$aPath&page=$prevp\">&lt;</a></td>";
      }

      
// show page no(s)
      
for($i=$minp$i<$maxp$i++) {
        
$p $i 1;
        if(
$aThisPage == $i) {
          echo 
"<td><b>$p</b></td>";
        } else {
          echo 
"<td><a href=\"fotos1.php?path=$aPath&page=$i\">$p</a></td>";
        }
      }

      
// show the next link
      
if($maxp $numPages) {
        
$nextp $maxp;
        echo 
"<td><a href=\"fotos1.php?path=$aPath&page=$nextp\">&gt;</a></td>";
      }
    }
  }
  echo 
"</tr>";
  echo 
"</table>";
  echo 
"</center>";
}


function 
readFiles($aPath)
{

  global 
$files$isDir;
  global 
$sortbyname;
  
$files = array();
  
$isDir = array();
  
$confdir "imgconfig";

  
$dir_handle = @opendir($aPath) or die("Unable to open $aPath");

  while(
$file readdir($dir_handle)) {
    
$fullpath $aPath.$file;

    if(
is_dir($fullpath)) {
      if(
$file != '.' && $file != '..' && $file != $confdir) {
        
$files[] = $file;
        
$isDir[] = true;
      }
    } else {
      
$ext substr($file, -4);
      
//if($file[0] != '.' && ($ext == '.jpg' || $ext == '.gif')) {
      
if($file[0] != '.' && (strtolower($ext) == '.jpg')) {
        
$files[] = $file;
        
$isDir[] = false;
      }
    }
    if(
$sortbyname) {
      
sort($files);
    }
  }

  
closedir($dir_handle);
}

function 
adjustPath($aPath)
{
  
$ret $aPath;
  if(!
$ret)
    
$ret "./";
  if(
substr($ret, -1) != "/")
  
$ret $ret.'/';

  
// reset to home, if illegal access
  
if(substr($ret01) != '.' || strstr($ret"..")) {
    
$ret'./';
  }

  return 
$ret;
}
?>
muchas gracias
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:30.