Posted By

Tate on 04/24/08


Tagged


Versions (?)


Advertising

Website Promotion DIRECTORY is a crucial factor for all websites that need to gain better organic search engine rankings and increase website traffic.
Submitting your website as part of your Web Promotion strategy to our SEO friendly and high traffic Business Directory for review is an excellent way to gain a valuable backlink and increase your websites visibility online.

Submit Site


Who likes this?

4 people have marked this snippet as a favorite

luman
mmccrack
stavelin
vali29


Pagination


Published in: PHP 






Expand | Embed | Plain Text
  1. //Above the loop
  2. $readerItems = $myReader->buildMyItems();
  3. $readerTotal = $readerItems;
  4.  
  5. $page=1;
  6. if (isset($_REQUEST['page']))
  7. $page = $_REQUEST['page'];
  8. $perPage = 30;
  9. $readerItems = array_slice($readerItems, (($page-1)*$perPage), $perPage, true);
  10.  
  11. //Below the loop for the links
  12. $currentPage = 1;
  13. if (isset($_REQUEST['page']))
  14. $currentPage = $_REQUEST['page'];
  15.  
  16. $pages = ceil(count($readerTotal) / $perPage);
  17. if ($currentPage != 1)
  18. echo "<a href='/my/index.php?page=".($currentPage-1)."'>Previous </a> ";
  19. echo 'Page ';
  20. for($x=1; $x<=$pages; $x++) {
  21. if ($x == $currentPage)
  22. echo ($x)." ";
  23. else
  24. echo "<a href='/my/index.php?page=$x'>$x</a> ";
  25. }
  26. if ($currentPage < $pages)
  27. echo "<a href='/my/index.php?page=".($currentPage+1)."'> Next</a>";

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: Tate on July 22, 2008

You need to login to post a comment.

Download royalty free graphics