Jump to content

Help fix my page system


codeboy89

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.