home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Sliding_example4.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  3.5 KB  |  119 lines

  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PEAR :: Pager_Sliding Example                          |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 1997-2003 The PHP Group                                |
  6. // +----------------------------------------------------------------------+
  7. // | This source file is subject to version 2.0 of the PHP license,       |
  8. // | that is bundled with this package in the file LICENSE, and is        |
  9. // | available at through the world-wide-web at                           |
  10. // | http://www.php.net/license/2_02.txt.                                 |
  11. // | If you did not receive a copy of the PHP license and are unable to   |
  12. // | obtain it through the world-wide-web, please send a note to          |
  13. // | license@php.net so we can mail you a copy immediately.               |
  14. // +----------------------------------------------------------------------+
  15. // | Author: Lorenzo Alberton <l.alberton at quipo.it>                    |
  16. // +----------------------------------------------------------------------+
  17.  
  18. require_once 'Pager/Sliding.php';
  19.  
  20. $params['totalItems'] = 800;
  21. $pager = &new Pager_Sliding($params);
  22. $data  = $pager->getPageData();
  23. $links = $pager->getLinks();
  24.  
  25.  
  26. ?>
  27. <html>
  28. <head>
  29. <title>Pager_Sliding examples</title>
  30. <style type="text/css">
  31. <!--
  32. a.myClass {
  33.     color: red;
  34.     font-family: verdana;
  35.     font-size: 10pt;
  36. }
  37. .myClass2 {
  38.     color: #222;
  39.     font-family: verdana;
  40.     font-size: 8pt;
  41. }
  42. // -->
  43. </style>
  44. </head>
  45. <body>
  46. <h1>Pager_Sliding</h1>
  47.  
  48. <hr />
  49. <span class="myClass2">Author: Lorenzo Alberton  <l.alberton at quipo.it></span> <br />
  50. go to <a href="SWPager_example1.php">Example1</a> - <a href="SWPager_example2.php">Example2</a> - <a href="SWPager_example3.php">Example3</a> - <a href="../">home</a>
  51. <hr />
  52.  
  53. <h2>Example 4</h2>
  54.  
  55. <?php
  56. $params = array(
  57.             'perPage'    => 3,
  58.             'delta'      => 2,
  59.             'expanded'   => true,
  60.             'itemData'   => array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z')
  61.             );
  62. $pager = &new Pager_Sliding($params);
  63. $data  = $pager->getPageData();
  64. $links = $pager->getLinks();
  65. ?>
  66.  
  67.  
  68. <pre>
  69. SETTINGS:
  70. $params = array(
  71.             'perPage'    => 3,
  72.             'delta'      => 2,
  73.             'expanded'   => true,
  74.             'itemData'   => array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z')
  75.             );
  76. $pager = &new Pager_Sliding($params);
  77. </pre>
  78.  
  79. <hr />
  80.  
  81. <b>Have a look at "expanded" mode:</b> Window width is always 2*$delta+1
  82.  
  83.  
  84. <br /> <br />
  85.  
  86. <table border="1" width="500" summary="example 1">
  87.     <tr>
  88.         <td colspan="3" align="center">
  89.             <?php echo $links['all']; ?>
  90.         </td>
  91.     </tr>
  92.  
  93.  
  94.     <tr>
  95.         <td colspan="3">
  96.             <pre>PAGED DATA: <?php print_r($data); ?></pre>
  97.         </td>
  98.     </tr>
  99. </table>
  100.  
  101.  
  102. <h4>Results from methods:</h4>
  103.  
  104. <pre>
  105. getCurrentPageID()...: <?php var_dump($pager->getCurrentPageID()); ?>
  106. getNextPageID()......: <?php var_dump($pager->getNextPageID()); ?>
  107. getPreviousPageID()..: <?php var_dump($pager->getPreviousPageID()); ?>
  108. numItems()...........: <?php var_dump($pager->numItems()); ?>
  109. numPages()...........: <?php var_dump($pager->numPages()); ?>
  110. isFirstPage()........: <?php var_dump($pager->isFirstPage()); ?>
  111. isLastPage().........: <?php var_dump($pager->isLastPage()); ?>
  112. isLastPageComplete().: <?php var_dump($pager->isLastPageComplete()); ?>
  113. $pager->range........: <?php var_dump($pager->range); ?>
  114. </pre>
  115.  
  116. <hr />
  117.  
  118. </body>
  119. </html>