Lion_87 nie wiem czy to o to ci chodziło ale coś takiego zrobiłem działa wszystko jest elegancko tak jak powinno
<?php
define('MAX', 6
); // maksymalna liczba wpisow na stronie $file = 'wpisy.txt';
$iCount = count($aLines); $iStart = @(int)$_GET['start'];
for($i=$iStart; $i < $iCount && $i < $iStart + 5; $i++) {
$data = explode('|||', $aLines[$i]); echo '<b>Imię:</b> '. $data[0] .'<br>'; echo '<b>e-mail:</b> '. $data[1] .'<br>'; echo '<b>www:</b> '. $data[2] .'<br>'; echo '<b>treść:</b> '. $data[3] .'<br>'; $tresc = wordwrap($data[4], 90, "<br>", 1
); echo $tresc .'<br><br><hr>'; }
pagenumbering
($iStart, MAX, $iCount, '');
}
/**
* $start - od ktorej pozycji mamy wyswietlac infromacje
* $one_page - ile informacji na jednej stronie
* $quantity - calkowita ilosc informacji mozliwych do wyswietlenia
* $get - czesc url, przesyla potrzebne dane
*/
function pagenumbering($start, $one_page, $quantity, $get='') {
// czy potrzebne jest stronicowanie
if($one_page >= $quantity) {
return;
}
// strzalka w lewo, wstecz
if($start!=0) {
echo '<a href="index.php?id=ksiega1'. $get .'&start='. ($start-$one_page) .'">wstecz</a> '; }
// numeruj strony, zaznacz na ktorej jestes
for($i=0, $j=1; $i<$quantity; $i+=$one_page, ++$j) {
if($start <= $i && $start > $i-$one_page) {
}
else {
echo '<a href="index.php?id=ksiega1'. $get .'&start='. $i .'">'. $j .'</a> '; }
}
// strzalka w prawo, dalej
if($start+$one_page < $quantity) {
echo '<a href="index.php?id=ksiega1'. $get .'&start='. ($start+$one_page) .'">dalej</a>'; }
}
?>