Cod: Selectaţi tot
$skip = array(
'adresa1.ro' => 'Adresa 1',
'adresa2.ro' => 'Adresa 2',
'adresa3.ro' => 'Adresa 3',
'adresa4.ro' => 'Adresa 4',
'adresa5.ro' => 'Adresa 5',
'adresa6.ro' => 'Adresa 6',
'adresa7.ro' => 'Adresa 7',
'adresa8.ro' => 'Adresa 8',
'adresa9.ro' => 'Adresa 9' ) ;
$totl = count( $skip ) ;
$pags = ceil( $totl / 3 ) ;
$page = intval( $_GET["page"] ) ? $_GET["page"] : 1 ;
$page = ( int )$page ;
if ( $page > $pags ) {
$page = $pags ;
}
if ( $page < 1 ) {
$page = 1 ;
}
if ( $page && $pags ) {
$start = ( $page - 1 ) * 3 ;
$finis = ( $page * 3 ) - 1 ;
if ( $finis > $totl - 1 ) {
$finis = ( $totl - 1 ) ;
}
foreach ( $skip as $id => $value ) {
for ( $i = $start; $i <= $finis; $i++ ) {
echo "<p>\n" ;
echo "<b><a href=\"" . $id . "\">" . $value . "</a></b>\n" ;
echo "</p>\n" ;
}
}
}
if ( $page > 2 ) {
echo "<a href=\"" . htmlentities( $_SERVER["PHP_SELF"] ) . "?page=1\">1</a>\n" ;
}
if ( $page > 1 ) {
echo "<a href=\"" . htmlentities( $_SERVER["PHP_SELF"] ) . "?page=" . ( $page - 1 ) . "\">" . ( $page - 1 ) . "</a>\n" ;
}
if ( $pags > 1 ) {
echo $page . "\n" ;
}
if ( $page < $pags ) {
echo "<a href=\"" . htmlentities( $_SERVER["PHP_SELF"] ) . "?page=" . ( $page + 1 ) . "\">" . ( $page + 1 ) . "</a>\n" ;
}
if ( $page < $pags - 1 ) {
echo "<a href=\"" . htmlentities( $_SERVER["PHP_SELF"] ) . "?page=" . $pags . "\">" . $pags . "</a>\n" ;
}
Eroarea pe care o intampin este ca nu-mi afiseaza cate 3 linkuri per pagina ci un sir lung de linii. Cine imi spune unde am gresit in cod si ma poate ajuta cu solutie?