Thread Closed  Post Thread 

pagination of php scripts
Author Message
nick
SEO Dictator

SEO Team

Posts: 1,177
Group: SEO Team
   
Cash: 432.01 Donate
pagination of php scripts

Pagination of php scripts can be a headache sometimes.

I have developed many scripts throughout my career as a php web developer. But most of my projects didn't needed php pagination in it.

Two years ago I came across some projects of mine which needed the pagination in it to make it more stable and extensible alowing the site to be browsable and more faster in navigation.

PHP Code:

<?php
// Navigation
if($page == 1)
{
$prev 1;
$next 2;
}
else
{
$prev $page 1;
$next $page 1;
}
$r mysql_query("Select COUNT(ID) from tblpages");
while ( 
$row mysql_fetch_array$r ) )
{
$cntr $row['COUNT(ID)'];
}
// Now we have the count in cntr
$last $cntr 10;
settype($last"Integer");
$last $last 1;
// Now final last check
if($next >= $last)
{
$next $last;
}
$first 1;
echo 
"<a href='page$first.html'>First</a> | ";
echo 
"<a href='page$prev.html'>Prev</a> | ";
echo 
"<a href='page$next.html'>Next</a> | ";
echo 
"<a href='page$last.html'>Last</a>";
?>



The above code will help you in implementing the pagination in your own php scripts and projects.

If you need any help in implementing this pagination function then please ask me over here or PM me.


DNDaily.com - Your Daily Domain Doze
Twut.com - Free Online Games
Product reviews and ratings
Search Engine Optimization Packages
03-05-2007 01:32 AM
Send the author a private message Find all posts by this author Quote this message in a reply

Thread Closed  Post Thread 


Similar Threads
Thread: Author Replies: Last Post
Looking for Java scripts tutorial jignesh 3 02-18-2007 04:23 AM
Developing php scripts nick 3 01-03-2007 03:25 PM
Opensource Social Networking and Tagging Scripts nick 4 02-22-2007 12:01 AM

View a Printable Version | Send this Thread to a Friend | Subscribe to this Thread | Add Thread to Favorites
Rate This Thread:
Forum Jump: