invatphp Posted July 15, 2012 Report Share Posted July 15, 2012 $skip = array( 'http://adresa1.ro' => 'Adresa 1', 'http://adresa2.ro' => 'Adresa 2', 'http://adresa3.ro' => 'Adresa 3', 'http://adresa4.ro' => 'Adresa 4', 'http://adresa5.ro' => 'Adresa 5', 'http://adresa6.ro' => 'Adresa 6', 'http://adresa7.ro' => 'Adresa 7', 'http://adresa8.ro' => 'Adresa 8', 'http://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? Link to comment Share on other sites More sharing options...
Moderators Dragos Posted July 15, 2012 Moderators Report Share Posted July 15, 2012 (edited) Ai postat in sectiunea gresita si n-ai nici macar 10 posturi. Revino cand ai. Edited July 15, 2012 by Dragos Link to comment Share on other sites More sharing options...
wildchild Posted July 15, 2012 Report Share Posted July 15, 2012 Poti sa inveti php, cu conditia sa citesti mai intai regulile si sa le respecti. Ban 5 zile! Link to comment Share on other sites More sharing options...