Ciao a tutti,
io ho creato un sistema di impaginazione grazie ad un tutorial su internet e ora volevo modificarlo in modo che non mi visualizzi più di 5 pagine (2 prima e 2 dopo quella selezionata) solo che non ho assolutamente idea di come fare.... qualcuno può aiutarmi?

posto il codice da modificare:
Codice PHP:
<?
// output paging system (could also do it before we output the page content) 
if ($page == or $offset 0){ // this is the first page - there is no previous page 
    
echo "<< | "
}
else{ 
// not the first page, link to the previous page 
    
echo "<a href=\"$_SERVER[PHP_SELF]?page=" . ($page 1) . "&BACH=$bacheca\" class='notstandard'><<</a> | ";
}
for (
$i 1$i <= $pager->numPages$i++) { 
 
    if (
$i == $pager->page){
        echo 
"$i"
    }
    else{
        echo 
"<a href=\"$_SERVER[PHP_SELF]?page=$i&BACH=$bacheca\" class='notstandard'>$i</a>"
    }
    echo 
" | ";
}

if (
$page == $pager->numPages){ // this is the last page - there is no next page 
    
echo ">>"
}
else{ 
// not the last page, link to the next page 
    
echo "<a href=\"$_SERVER[PHP_SELF]?page=" . ($page 1) . "&BACH=$bacheca\" class='notstandard'>>></a>"
}
echo 
"</div>
"
;
?>
risultato:
[U]<<[/U]  | [U]1[/U]  | [U]2[/U]  | [B]3[/B]  | [U]4[/U]  | [U]>>[/U]
grazie