-
Notifications
You must be signed in to change notification settings - Fork 17
/
example_unordered_list.php
113 lines (99 loc) · 3.02 KB
/
example_unordered_list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
require_once 'Pager/Pager.php';
//create dummy array of data
$myData = array();
for ($i=0; $i<200; $i++) {
$myData[] = $i;
}
$params = array(
'itemData' => $myData,
'perPage' => 10,
'delta' => 8, // for 'Jumping'-style a lower number is better
'append' => true,
'clearIfVoid' => false,
'urlVar' => 'entrant',
'useSessions' => true,
'closeSession' => true,
//'mode' => 'Sliding', //try switching modes
'mode' => 'Jumping',
'prevImg' => '« Previous',
'nextImg' => ' Next »',
//settings best used for lists:
'separator' => '', //you shouldn't use anywhere, especially in lists
'spacesBeforeSeparator' => 0, //or spaces
'spacesAfterSeparator' => 0,
'linkContainer' => 'li', //default is nothing, now optionally wraps links with a html tag
'curLinkContainerClassName' => 'active', //if you want <li class="active"><a>page#</a></li>
'curTag' => 'a', //default is span as that's what it used to be, now it's changeable
//'curPageLinkClassName' => 'active', //if you want <li><a class="active">page#</a></li> instead of using curLinkContainerClassName
);
$pager = & Pager::factory($params);
$page_data = $pager->getPageData();
$links = $pager->getLinks();
$selectBox = $pager->getPerPageSelectBox();
?>
<html>
<head>
<title>new PEAR::Pager example using a list</title>
<style>
ul.pagination li {display:inline; margin:3px;}
ul.pagination li a {
display: inline-block;
margin: 0;
padding:2px 5px;
border:1px solid #000000;
background-color:#EEEEEE;
color:#000;
text-decoration: none;
font-size:11px;
font-weight:bold;
}
ul.pagination li.active a {
color: white;
border:1px solid black;
background-color:maroon;
cursor:pointer;
}
ul.pagination li a:hover {
color: maroon;
border:1px solid maroon;
background-color:#FFFFE0;
}
</style>
</head>
<body>
<table border="1" width="500" summary="example 1">
<tr>
<td colspan="3" align="center">
<ul class="pagination">
<?php echo $links['all']; ?>
</ul>
</td>
</tr>
<tr>
<td colspan="3">
<pre><?php print_r($page_data); ?></pre>
</td>
</tr>
</table>
<h4>Results from methods:</h4>
<pre>
getCurrentPageID()...: <?php var_dump($pager->getCurrentPageID()); ?>
getNextPageID()......: <?php var_dump($pager->getNextPageID()); ?>
getPreviousPageID()..: <?php var_dump($pager->getPreviousPageID()); ?>
numItems()...........: <?php var_dump($pager->numItems()); ?>
numPages()...........: <?php var_dump($pager->numPages()); ?>
isFirstPage()........: <?php var_dump($pager->isFirstPage()); ?>
isLastPage().........: <?php var_dump($pager->isLastPage()); ?>
isLastPageComplete().: <?php var_dump($pager->isLastPageComplete()); ?>
$pager->range........: <?php var_dump($pager->range); ?>
</pre>
<hr />
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
Select how many items per page should be shown:<br />
<?php echo $selectBox; ?>
<input type="submit" value="submit" />
</form>
<hr />
</body>
</html>