codeboy89 Posted November 16, 2009 Share Posted November 16, 2009 I am not sure why it is not working, once it creates multiple pages, when you click a page number it makes the link doesnt go to the page? code: // Max amount of posts on one page $posts = 5; // Count the number of posts $foo = preg_split ("<.*ponmurt.*>", $file); $count = count($foo); $posts = ($posts * 2); $pages = round($count / $posts) + 1; // Write the required page numbers $i = $pages; print "<p>"; if ( $count > $posts) { print "page "; while ( $i > 0) { if ( $page == "") { $page = $pages; } if ( $page == $i) { print "<b><font size = \"3\"> $i </b></font>"; } else { print "<a href=index.php?page=$i> $i </a>"; } --$i; } } print "<hr ALIGN = CENTER WIDTH = 70%>"; print "<br/></p>"; // Always begin at the last page if ( $page == "") { $from = $count; $to = ( $count - $posts); while ( $from > $to) { $post = $foo[$from]; print "$post"; $from--; } } else { $counter = $pages - $page + 1; $from = ($count - (($counter-1) * $posts)); $to = ($count - (($counter) * $posts)); while ($from > $to) { $post = $foo[$from]; print "$post"; $from--; } } // Write the required page numbers $i = $pages; print "<hr ALIGN = CENTER WIDTH = 70%>"; print "<p>"; if ( $count > $posts) { print "page"; while ( $i > 0) { if ( $page == "") { $page = $pages; } if ( $page == $i) { print "<b><font size = \"3\"> $i </b></font>"; } else { print "<a href=index.php?page=$i> $i </a>"; } --$i; } } print "</p>"; } Link to comment https://forums.phpfreaks.com/topic/181768-help-fix-my-page-system/ Share on other sites More sharing options...
codeboy89 Posted November 16, 2009 Author Share Posted November 16, 2009 any ideas? thank you Link to comment https://forums.phpfreaks.com/topic/181768-help-fix-my-page-system/#findComment-958726 Share on other sites More sharing options...
Irresistable Posted November 16, 2009 Share Posted November 16, 2009 If that is used on index.php, try remove the "index.php" from all links, so it looks like ?page=$i I'm not sure, but It might be reloading the whole page as index.php instead of ?page=2 etc Link to comment https://forums.phpfreaks.com/topic/181768-help-fix-my-page-system/#findComment-958731 Share on other sites More sharing options...
codeboy89 Posted November 17, 2009 Author Share Posted November 17, 2009 It is used on index.php, but that did not work. Thanks for your help though. Any other ideas? Link to comment https://forums.phpfreaks.com/topic/181768-help-fix-my-page-system/#findComment-958855 Share on other sites More sharing options...
Irresistable Posted November 17, 2009 Share Posted November 17, 2009 I've no idea, I'd just find a tutorial... work like that. I'm not an expert with what you've got there. Are you trying to use pagination..? Link to comment https://forums.phpfreaks.com/topic/181768-help-fix-my-page-system/#findComment-959139 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.