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 7
Other forums
Typing math
I've added support for typesetting math using LaTeX on the forums.
Example:
Code: [Select]
Add User script "Could not execute query"
This should be an easy script but I can't get it to run. Can someone please help me?
<
Got A Free Server :(
So I was given a free server
http://shopping.yahoo.com/p:Compaq%20ProLiant%201500%20Server:1
SOAP Issue
Hi,
I am facing some understanding problem with SOAP basic.kindly recommend some SOAP expert.
Add weeks in a query?
I have a SQL that summarizes the quantity per week. The weeks that has no value does not exist in th
quick basic question, hopefully not dumb
I don't know how to search for this, so forgive me if it's been covered...
I often see an exa
array empty
Hiya peeps,
Ok here is the codes.
order.php
Code:
Table trouble
i have been reading the forum for a few weeks and decided to join. i like the format and the advice
Sending a hyperlink through mail
HI all,
I am sending a mail to outlook mailbox of a user using FM SO_NEW_DOCUMENT_ATT_S
How to generate a random array of integers subject to a certain constraint
I am writing a program that asks the user to enter an integer N and then generates a random array of