home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Sliding_example1.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  2.9 KB  |  102 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 example 1</title>
  30. <style type="text/css">
  31. <!--
  32. .myClass2 {
  33.     color: #222;
  34.     font-family: verdana;
  35.     font-size: 8pt;
  36. }
  37. // -->
  38. </style>
  39. </head>
  40. <body>
  41. <h1>Pager_Sliding</h1>
  42.  
  43. <hr />
  44. <span class="myClass2">Author: Lorenzo Alberton  <l.alberton at quipo.it></span> <br />
  45. 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="SWPager_example4.php">Example4</a> - <a href="../">home</a>
  46. <hr />
  47.  
  48. <h2>Example 1</h2>
  49.  
  50. <pre>
  51. SETTINGS:
  52. $params['totalItems'] = 800;
  53. $pager = &new Pager_Sliding($params);
  54. </pre>
  55.  
  56. <table border="1" width="500" summary="example 1">
  57.     <tr>
  58.         <td colspan="3" align="center">
  59.             <?php echo $links['all']; ?>
  60.         </td>
  61.     </tr>
  62.  
  63.  
  64.     <tr>
  65.         <td colspan="3">
  66.             <pre><?php print_r($data); ?></pre>
  67.         </td>
  68.     </tr>
  69. </table>
  70.  
  71. <h4>Results from methods:</h4>
  72.  
  73. <pre>
  74. getCurrentPageID()...: <?php var_dump($pager->getCurrentPageID()); ?>
  75. getNextPageID()......: <?php var_dump($pager->getNextPageID()); ?>
  76. getPreviousPageID()..: <?php var_dump($pager->getPreviousPageID()); ?>
  77. numItems()...........: <?php var_dump($pager->numItems()); ?>
  78. numPages()...........: <?php var_dump($pager->numPages()); ?>
  79. isFirstPage()........: <?php var_dump($pager->isFirstPage()); ?>
  80. isLastPage().........: <?php var_dump($pager->isLastPage()); ?>
  81. isLastPageComplete().: <?php var_dump($pager->isLastPageComplete()); ?>
  82. $pager->range........: <?php var_dump($pager->range); ?>
  83. </pre>
  84.  
  85. <hr />
  86.  
  87. <pre>
  88. NB:
  89.  
  90. <b>echo $pager->links</b>
  91.  
  92. is the same as
  93.  
  94. <b>$links = $pager->getLinks();
  95. echo $links['all'];
  96. </b>
  97. </pre>
  98.  
  99. <hr />
  100.  
  101. </body>
  102. </html>