Jump to content

Recommended Posts

friends currently my pagination shows like

 

pages count

 

Page 2 of 11

 

clickable link

Prev»  Next»

 

how can i achieve to get the countable page numbers to show like clickable and then 1, 2, 3 , 4  etc no matter how many there are.

 

here are the codes

 

$p = 1;
if ($nxpage == "")$nxpage = "1";
$countfile= count($items);
$countfile=$countfile-2;
$first=($nxpage*$p)-$p;
$nxpages = ceil($countfile / $p);

$next_arrays=($first+($p-1));






if ($nxpage <= $nxpages and $nxpage>1) $gline_rew1 = '<a 
href="'.$_SERVER["PHP_SELF"].'?nxpage='.($nxpage-1).'">Prev&#187;</a> ';
if ($nxpages > 1 and $nxpage<$nxpages) $gline_next1 = ' <a 
href="'.$_SERVER["PHP_SELF"].'?nxpage='.($nxpage+1).'">Next&#187;</a>';
echo "Page {$nxpage} of {$nxpages} <br/> ".$gline_rew1.$gline_next1."";

Link to comment
https://forums.phpfreaks.com/topic/240951-modifying-pagination-issue/
Share on other sites

The variable $nxpages contains the numbers of pages you have. To display a link for each page you'd use for loop.

 

Something like this should work

for($i = 1; $i <= $nxpages; $i++)
    echo ' <a href="'.$_SERVER["PHP_SELF"].'?nxpage='.$i'">'.$i.'</a> ';

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.