Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
848 florian 1
<?php
2
require_once 'Pager/Pager.php';
3
 
4
//create dummy array of data
5
$myData = array();
6
for ($i=0; $i<200; $i++) {
7
    $myData[] = $i;
8
}
9
 
10
$params = array(
11
    'itemData' => $myData,
12
    'perPage' => 10,
13
    'delta' => 8,             // for 'Jumping'-style a lower number is better
14
    'append' => true,
15
    //'separator' => ' | ',
16
    'clearIfVoid' => false,
17
    'urlVar' => 'entrant',
18
    'useSessions' => true,
19
    'closeSession' => true,
20
    //'mode'  => 'Sliding',    //try switching modes
21
    'mode'  => 'Jumping',
22
 
23
);
24
$pager = & Pager::factory($params);
25
$page_data = $pager->getPageData();
26
$links = $pager->getLinks();
27
 
28
$selectBox = $pager->getPerPageSelectBox();
29
?>
30
 
31
<html>
32
<head>
33
<title>new PEAR::Pager example</title>
34
</head>
35
<body>
36
 
37
<table border="1" width="500" summary="example 1">
38
	<tr>
39
		<td colspan="3" align="center">
40
		<?php echo $links['all']; ?>
41
		</td>
42
	</tr>
43
 
44
 
45
	<tr>
46
		<td colspan="3">
47
			<pre><?php print_r($page_data); ?></pre>
48
		</td>
49
	</tr>
50
</table>
51
 
52
<h4>Results from methods:</h4>
53
 
54
<pre>
55
getCurrentPageID()...: <?php var_dump($pager->getCurrentPageID()); ?>
56
getNextPageID()......: <?php var_dump($pager->getNextPageID()); ?>
57
getPreviousPageID()..: <?php var_dump($pager->getPreviousPageID()); ?>
58
numItems()...........: <?php var_dump($pager->numItems()); ?>
59
numPages()...........: <?php var_dump($pager->numPages()); ?>
60
isFirstPage()........: <?php var_dump($pager->isFirstPage()); ?>
61
isLastPage().........: <?php var_dump($pager->isLastPage()); ?>
62
isLastPageComplete().: <?php var_dump($pager->isLastPageComplete()); ?>
63
$pager->range........: <?php var_dump($pager->range); ?>
64
</pre>
65
 
66
 
67
<hr />
68
 
69
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
70
Select how many items per page should be shown:<br />
71
<?php echo $selectBox; ?> &nbsp;
72
<input type="submit" value="submit" />
73
</form>
74
 
75
<hr />
76
 
77
</body>
78
</html>