Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Stronnicowanie problem, Problem ze zmianą tekstu
głupol
post
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 25.04.2006

Ostrzeżenie: (0%)
-----


<?php
$file = file("dane/newsy.txt");
if($perpage == FALSE) $perpage = 5;
if($pos == FALSE) $pos = 0;
$count = count($file);
for($i = $pos; $i < ($perpage+$pos); $i++)
{
if($i > $count-1) break;
$result = explode("|", trim($file[$i]));

echo "<li>$result[0] $result[1]\n";
}

echo "<div align=\"center\">[ ";
for($p = 0; $p < $count; $p++)
{
if(!($p % $perpage))
{
$pg = ($p/$perpage)+1;
if ($p == $pos)
{
echo "<strong>$pg</strong> ";
}
else
{
echo "<a href=\"?pos=$p\">$pg</a> ";
}
}
}
echo " ]</div>";
?>
Mam problem , tekst podzielony w txt nie zmienia się po naciśnieciu 1 2 3 (tzn nie przeskakuje do dalszej części tekstu Co jest źle (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Vogel
post
Post #2





Grupa: Zarejestrowani
Postów: 402
Pomógł: 0
Dołączył: 20.01.2003

Ostrzeżenie: (0%)
-----


po pierwsze

  1. <?php
  2.  
  3. if($perpage == FALSE) $perpage = 5; // ŹLE
  4. if(!isset($perpage)) $perpage = 5; // DOBRZE
  5.  
  6. ?>


po drugie. masz wylaczone zmienne globalne (i tak ma byc) wiec musisz sprawdzac zmienne _POST i _GET


  1. <?php
  2.  
  3. if($perpage == FALSE) $perpage = 5; // ŹLE
  4.  
  5. if(!isset($_GET['perpage'])) 
  6. $perpage = 5;
  7. else
  8. $perpage = $_GET['perpage']; // DOBRZE
  9.  
  10. ?>


reszte zostawiam tobie...
Go to the top of the page
+Quote Post

Posty w temacie


Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.12.2025 - 00:12