darkfreaks Posted February 16, 2008 Share Posted February 16, 2008 ok my pagnation wont go onto page 2 itj ust shows up blank any thoughts ??? <?php echo"<p align='right'>"; function paginate($last, $page, $href, $max_results=25) { $span = $max_results-2; // Remove the first & last pages from display... $pad = floor(($span-1)/2); // Round down to make this "symmetrical" // No matter what, we'll show the Previous & first page link: if($$page > 1) $content = '<a href="' . $href . '?page=' . ($page-1) . '">« Previous</a>'; else $content = '« Previous'; if($current == 1) $content .= ' <a href="' . $href . '?page=1" class="page">1</a>'; else $content .= ' <a href="' . $href . '?page=1" class="">1</a>'; # If the current page is in the first part if($page >= 1 && $page <= $max_results) { for($i=2; $i<=$span+1; $i++) { $class = ($page == $i) ? 'page' : ''; $content .= ' <a href="' . $href . '?page=' . $i . '" class="' . $class . '">' . $i . '</a>'; } // Ellipsis between span and last number. i.e.: 15 ... 25 Next $content .= ' ...'; } # If the current page is in the last part of the links elseif($page <= $last && $page >= $last-($max_results-1)) { // Ellipsis between 1 and next number. i.e.: 1 ... 10 $content .= ' ...'; for($i=($last-$span); $i<$last; $i++) { $class = ($page == $i) ? 'page' : ''; $content .= ' <a href="' . $href . '?page=' . $i . '" class="' . $class . '">' . $i . '</a>'; } } # Otherwise, just show the parts we need... else { // Ellipsis between 1 and next number. i.e.: 1 ... 10 $content .= ' ...'; for($i=($page-$pad); $i<=($page+$pad); $i++) { $class = ($page == $i) ? 'page' : ''; $content .= ' <a href="' . $href . '?page=' . $i . '" class="' . $class . '">' . $i . '</a>'; } // Ellipsis between span and last number. i.e.: 15 ... 25 Next $content .= ' ...'; } // Show the last page... if($last == $page) $content .= ' <a href="' . $href . '?page=' . $last . '" class="page">' . $last . '</a>'; else $content .= ' <a href="' . $href . '?page=' . $last . '">' . $last . '</a>'; // Show the Next link... if($current < $last) $content .= ' <a href="' . $href . '?page=' . ($page+1) . '">Next »</a>'; else $content .= ' Next »'; // Return the link stuff... return $content; } echo 'Current Page: 1 :: ' . paginate(25, 1, $_SERVER['PHP_SELF'], 11); echo '<br /><br />'; ?> Quote Link to comment Share on other sites More sharing options...
Chris92 Posted February 16, 2008 Share Posted February 16, 2008 The first thing i saw was if($$page > 1) should be if($page > 1) . Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 16, 2008 Author Share Posted February 16, 2008 still shows blank? i fixed all the currents to be $page still nothing ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.