pagination numbering pattern


Posted on 16th Feb 2014 07:03 pm by admin

Hello,

I have following code which works great for pagination. but i have small issue now.
Now the output is coming like this

Quotemypage.php?page=2

I want it like this
Quotemypage.php/2

code-

Code: $numrows = 100;

//$numrows = $row['numrows'];
//echo "$row[numrows]";


// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);
echo "$maxPage";
$self = 'mypage.php';

// creating 'previous' and 'next' link
// plus 'first page' and 'last page' link

// print 'previous' link only if we're not
// on page one

$Nav="";
If($pageNum > 1) {
$Nav .= "<a class='nav' href="$self?page=" . ($pageNum-1) . " "><< Prev</a>";
}
/*For($i = 1 ; $i <= $maxPage ; $i++) {
If($i == $pageNum) {
$Nav .= "<b>$i</b>";
}Else{
$Nav .= "<a class='nav' href="$self?page=" . $i . "">$i</a>";
}
}*/
If($i == $pageNum)
{
$Nav .= "<p class='page'>1</p>";
}
Else
{

$page1=$pageNum-1;
if($page1==0){}
else
{
$Nav .= "<p class='pagination'><a href="$self?page=" . $page1. "">$page1</a></p>";
}

$Nav .= "<p class='page'>$pageNum</p>";

$page2=$pageNum+1;

if($page2<=$maxPage)
{
$Nav .= "<p class='pagination'><a href="$self?page=" . $page2. "">$page2</a></p>";
}
else{
}
}
If($pageNum < $maxPage) {
$Nav .= "<a class='nav' href="$self?page=" . ($pageNum+1) . "">Next >></a>";
}

Echo "

" . $Nav;

/* for showing all rows
$Nav="";
If($pageNum > 1) {
$Nav .= "<a class='nav' href="$self?page=" . ($pageNum-1) . " "><< Prev</a>";
}
For($i = 1 ; $i <= $maxPage ; $i++) {
If($i == $pageNum) {
$Nav .= "<b>$i</b>";
}Else{
$Nav .= "<a class='nav' href="$self?page=" . $i . "">$i</a>";
}
}
If($pageNum < $maxPage) {
$Nav .= "<a class='nav' href="$self?page=" . ($pageNum+1) . "">Next >></a>";
}

Echo "

" . $Nav;
*/

/*$Nav="";

if ($pageNum > 1)
{
$page = $pageNum - 1;

$Nav = " <a href="$self?page=$page">|Prev|</a> ";

$Nav = " <a href="$self?page=1">|<<</a> ";
//echo "$first";
}
else
{
$Nav = ' |Prev| '; // we're on page one, don't enable 'previous' link
$Nav = ' |<< '; // nor 'first page' link
}

// print 'next' link only if we're not
// on the last page
echo "$pageNum";
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$Nav = " <a href="$self?page=$page">|Next|</a> ";

$Nav = " <a href="$self?page=$maxPage">>>|</a> ";
}
else
{
$Nav = ' |Next| '; // we're on the last page, don't enable 'next' link
$Nav = ' >>| '; // nor 'last page' link
}

Echo "

" . $Nav;*/
can anyone please tell me how can i achieve that?
Thanks in advance.

No comments posted yet

Your Answer:

Login to answer
284 Like 7 Dislike
Previous forums Next forums
Other forums

Image resize
Hi again fellers

I managed to sort out the issues with the folder,

Final hurdle is th

Setting/Modify Headers using mail() function
I have a question about setting email headers when using mail() in a php script.

When I send

TemplatePower & AJAX
Hi all,



I'm currently implementing some AJAX features in my PHP-framework (which is b

Prevent PHP mail( ) from appending hostname to from address
Hey guys,

I want to be able to send texts to phones via email (since each phone has their own

Help with explandable category tree
I have the below query:

SELECT l1.id as lev1_id,l2.id as lev2_id,l3.id as lev3_id,l1.categ

New to mysqli library - Multiple query problem
Greetings,

I am writing a batch program that executes 3 queries on a single page. Using mysql

Serial number of exernal hard disk/Thumbdrive
Hi guys, I am new tio java networking concepts.Please tel me how to get Serial number of exernal

Inserting the current date/time while submitting the forum
What do I need to add below to update the current date/time? I have a field in the database called d

pageination not working right... coping images over 4 pages
Code: <?php //This code will obtain the required page number from the $_GET array. Note that

Displaying returned XML in another PHP page
I have an online payment form that will return XML given if a payment is successful or declines. I

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash