Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/12/2008, 13:53
machoman112233
Invitado
 
Mensajes: n/a
Puntos:
Opinion y ayuda con paginacion de un texto

Buenas!!!

Haver... he echo este archivo de paginacion para texto y quiero saber como se puede mejorar o algo para retocar...

Ademas me da unos notice: indefinid offset en esta linea ($texto[$i].=$partes_texto[$j];) y no se como resolverlo...

Código php:
Ver original
  1. Notice: Undefined offset: 0 in C:\Program Files (x86)\EasyPHP 2.0b1\www\new_web\Untitled1.php on line 33
  2.  
  3. Notice: Undefined offset: 1 in C:\Program Files (x86)\EasyPHP 2.0b1\www\new_web\Untitled1.php on line 33
  4.  
  5. Notice: Undefined offset: 2 in C:\Program Files (x86)\EasyPHP 2.0b1\www\new_web\Untitled1.php on line 33

Código php:
Ver original
  1. $temas=mysql_fetch_assoc($resultado);
  2.  
  3. (!isset($_GET["pagina"]))? $pagina=1:$pagina=$_POST["pagina"];
  4. $contar=0;
  5. for($ind=0;$ind<strlen($temas["contenido"]);$ind++)
  6. {
  7.     if($temas["contenido"][$ind]=="\n")
  8.     {
  9.         $contar++;
  10.     }
  11. }
  12.  
  13.    
  14. $partes_texto=explode("\n",$temas["contenido"],$contar);
  15. $pag=ceil(count($partes_texto)/10);
  16. $ini=0;
  17. $fin=10;
  18. $texto=array();
  19.    
  20. for($i=0;$i<$pag;$i++)
  21. {
  22.     for($j=$ini;$j<$fin;$j++)
  23.     {
  24.         if(isset($partes_texto[$j]))
  25.         {
  26.             $texto[$i].=$partes_texto[$j];
  27.         }
  28.     }
  29.     $ini=$j;
  30.     $in=$i+1;
  31.     $fin=($in+1)*10;
  32. }
  33. echo BBCode($texto[$pagina-1]);