<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
 
<html>
 
<head>
 
<title>Example 2</title>
 
<style type="text/css">
 
<!-- 
 
body { margin-top: 20px;
 
             margin-left: 150px;
 
             margin-right: 150px;
 
             background-color: #FFFF99; 
 
             font-family: Verdana;
 
 } 
 
h1 { font-size: 150%;
 
 }
 
-->
 
</style>
 
</head>
 
<center>
 
<body>
 
<h1>Example 2</h1>
 
<?php
 
  //=================================================================================
 
    //This shows how to set things up to get your input from an array.  This could be
 
    //used to make an image gallery or to display anything else you might store in
 
    //an array. This page uses  Paginator_html for the pre-made links.  The results
 
    //are pretty basic.  You should be able to use something like CSS to customize these
 
    //for you own site. This page uses the previousNext() method. 
 
    //==================================================================================
 
  //include the main class
 
    include("include/paginator.php");
 
    //include the extension that makes the pre-made links
 
    include("include/paginator_html.php");
 
    //Makes the array used in this example.
 
        for($i=0; $i < 25; $i++)
 
            {
 
            $p=$i+1;
 
            $pictures[$i]="pict" . $p . ".jpg";
 
            }
 
        //gets the total number of items
 
    $num_rows = count($pictures);
 
        //========================================================================
 
        //Parts used to make a new paginator 
 
        //========================================================================
 
        //Makes new Paginator_html.  Current page here is sent by the get method. 
 
        //$num_rows is the total items in the source.
 
    $a =& new Paginator_html($_GET['page'],$num_rows);
 
    //sets the number of records displayed
 
        //defaults to five
 
        $a->set_Limit(4); 
 
        // if using numbered links this will set the number before and behind 
 
        //the current page.
 
        //defaults to five
 
        $a->set_Links(3);  
 
        //gets starting point.
 
        $limit1 = $a->getRange1();  
 
        //gets number of items displayed on page.
 
        $limit2 = $a->getRange2();  
 
        //=========================================================================
 
        //Printing out the items in the array
 
        for($j=$limit1; $j < $limit1 + $limit2; $j++)
 
            {
 
            echo "<strong>" . $pictures[$j] . "</strong></p>";
 
            }
 
        //=========================================================
 
        //Put this where you want your links to appear
 
            $a->previousNext();
 
        //=========================================================
 
            //uncomment for some info that may be helpful in debugging.
 
            //echo '<pre>'; print_r($a); echo '</pre>';
 
?>
 
</center>
 
<p>This is an example of one of the pre-made set of links. It uses the Paginator
 
class and the Paginator_html extension class. I use an array here to show that you 
 
can use this class with sources other then a database. Also I did this so you could
 
get an idea of how this works without having to go to the trouble of setting up a
 
database. This output is fairly plain which should make it easier to use something like
 
CSS to fit it into the look of your own site.
 
</p>
 
<p>
 
Check the source code of this page to see how to set something like this up.</p>
 
<a href="index.php">Back to Index</a>
 
</body>
 
</html>
 
 
 |