Site Navigation Code
  Home arrow Site Navigation Code arrow show result with paging and staging
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
SITE NAVIGATION CODE

show result with paging and staging
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2002-01-18

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    You have a query results number about 100000 record, then what you should do to view all of them ?, paging ?...yah good, but how many page would it shown in your page if every page is only view 100 record ? 1000 link page ? get real!!!.

    By : hermawan

    <?php
    /*
    * myPageNumber Function
    * Author : Hermawan Haryanto
    * Create date : 02/02/2001
    * Update date : 03/20/2001
    */
    Function myPageNumber($nowstage,$startpage,$allpage,$nowpage,$pageperstage,$allstage)
    {
    if(trim($nowpage)>1)
    {
    $links.="&nbsp;<a href='$PHP_SELF?nowstage=1&nowpage=1'>&lt;&lt;&lt;</a>&nbsp;\n";
    }
    if(trim($nowstage)>1)
    {
    $links.="&nbsp;<a href='$PHP_SELF?nowstage=".($nowstage-1)."&nowpage=".((($nowstage-1)*$pageperstage)-($pageperstage-1))."'>&lt;&lt;</a>&nbsp;\n";
    }
    for($i=$startpage;$i<=$allpage;$i++)
    {
    if(trim($nowpage)=="")
    {
    $nowpage=$startpage;
    }
    $endpage=(($startpage+$pageperstage)-1);
    if($i>=$startpage&&$i<=$endpage&&$i<=$allpage)
    {
    if($nowpage!=((($nowstage-1)*$pageperstage)+$i)&&$i==$startpage&&$nowpage>$startpage)
    {
    $links=$links."&nbsp;<a href='$PHP_SELF?nowstage=$nowstage&nowpage=".($nowpage-1)."'>&lt;</a>&nbsp;\n";
    }
    if(((($nowstage-1)*$pageperstage)+$i)==$nowpage&&((($nowstage-1)*$pageperstage)+$i)<=$allpage)
    {
    $links=$links."&nbsp;<b>".((($nowstage-1)*$pageperstage)+$i)."</b>&nbsp;";
    }
    if(((($nowstage-1)*$pageperstage)+$i)!=$nowpage&&((($nowstage-1)*$pageperstage)+$i)<=$allpage)
    {
    $links=$links."&nbsp;<a href='$PHP_SELF?nowstage=$nowstage&nowpage=".((($nowstage-1)*$pageperstage)+$i)."'>".((($nowstage-1)*$pageperstage)+$i)."</a>&nbsp;\n";
    }
    if(($i==$endpage||$i==$allpage)&&$nowpage!=((($nowstage-1)*$pageperstage)+$i)&&$allpage>$nowpage)
    {
    $links=$links."&nbsp; <a href='$PHP_SELF?nowstage=$nowstage&nowpage=".($nowpage+1)."'>&gt;</a>&nbsp;\n";
    }
    }
    }
    if($nowstage<$allstage)
    {
    $links=$links. "&nbsp;<a href='$PHP_SELF?nowstage=".($nowstage+1)."&nowpage=".(($nowstage*$pageperstage)+1)."'>&gt;&gt;</a>&nbsp;\n";
    }
    if($nowpage<$allpage)
    {
    $links.="&nbsp;<a href='$PHP_SELF?nowstage=".$allstage."&nowpage=".$allpage."'>&gt;&gt;&gt;</a>&nbsp;\n";
    }
    return $links;
    }
    $number="100"; // record results selected from database
    $displayperpage="5"; // record displayed per page
    $pageperstage="5"; // page displayed per stage
    $allpage=ceil($number/$displayperpage); // how much page will it be ?
    $allstage=ceil($allpage/$pageperstage); // how many page will it be ?
    if(trim($startpage)==""){$startpage=1;}
    if(trim($nowstage)==""){$nowstage=1;}
    if(trim($nowpage)==""){$nowpage=$startpage;}
    ?>

    <font face=tahoma size=2>
    Records result from query statement : <b><?=$number;?></b> record.<br>
    Want to show <b><?=$displayperpage;?></b> in every page.<br>
    Want to show only <b><?=$pageperstage;?></b> page on every stage.<br>
    Then there would be <b><?=$allpage;?></b> page of results.<br>
    And there would be <b><?=$allstage;?></b> stage of pages.<br><br>
    <b>PAGING</b> : <?=myPageNumber($nowstage,$startpage,$allpage,$nowpage,$pageperstage,$allstage);;?><br>
    <b>Stage</b> <?=$nowstage." of ".$allstage;?><br><b>Page</b> <?=$nowpage." of ".$allpage;?><br>
    <?php
    for($i=1;$i<=$displayperpage;$i++)
    {
    echo "<br>".((($nowpage-1)*$displayperpage)+$i);
    }
    ?>
    </font>
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Site Navigation Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Driving Business Success with Rational Process Library

    Join this webcast, to learn how the Rational Process Library can help with compliance issues, drive process improvement, and assist in service-oriented architecture (SOA) or Agile development. We will take a peek into the Rational Process Library with content around software and systems engineering (including RUP), operations and systems management, program and portfolio management, and asset and SOA governance.
    FREE! Go There Now!


    NEW! Build Web services with transport-level security using Rational Application Developer V7, Part 1: Build Web services and Web services clients

    Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services.
    FREE! Go There Now!


    NEW! Don't wait! Try the Rational Application Developer (RAD) v7.5 open beta code today

    Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems.
    FREE! Go There Now!


    NEW! Download IBM Rational Developer for System z

    Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects.
    FREE! Go There Now!


    NEW! Evaluate IBM Lotus Sametime Standard V8.0

    Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration.
    FREE! Go There Now!


    NEW! Hacking 101

    Join us for this web seminar to learn how you can defend your web applications from attack. Learn about the 3 most common web application attacks, including how they occur and what can be done to prevent them. We’ll also discuss manual versus automated approaches for scanning and identifying web application vulnerabilities and how IBM Rational AppScan, an automated vulnerability scanner, can help you automate more of what you are doing manually today.
    FREE! Go There Now!


    NEW! Project and Portfolio Management Executive Resource Kit

    Portfolio Management is about effectively managing portfolio value by aligning portfolio investments with business goals. This complimentary e-kit provides a collection of materials that can help you understand how IBM Rational enables and automates best practices for improved governance and clear visibility into portfolio and project performance across the entire IT project lifecycle.
    FREE! Go There Now!


    NEW! Run your first CICS application on a PC using TXSeries for Windows

    Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Performance Tester V7.0.1

    Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for People

    Visit IBM developerWorks to try the IBM SOA Sandbox for people. The SOA Sandbox for people provides a trial environment with the necessary tooling and components required to enable consistent human and process interaction and collaboration, showing how you can improve user experience and business productivity.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    SITE NAVIGATION CODE ARTICLES

    - Simple Menu System
    - Simply image viewer script
    - Simple File Lister
    - Dynamic Error Pages
    - BSoftEditor
    - Yahoo Status
    - Page numbers
    - PHP Search Navigator 1.0
    - Simple Page Navigation
    - An easy page browser ( prev 6 7 8 9 10 next )
    - AutoIndex PHP Script (Directory Indexer)
    - Bs_HtmlNavigation (Navigation and Sitemap cl...
    - Another Paging with Stage
    - Website Navigation via PHP
    - MySQL Paging Class





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek