| 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 |
//set a string
|
|
|
11 |
$test_strings_encoded = array(
|
|
|
12 |
'encoded1' => '测试',
|
|
|
13 |
'encoded2' => '안녕',
|
|
|
14 |
);
|
|
|
15 |
$test_strings_plain = array(
|
|
|
16 |
'plain1' => '안녕',
|
|
|
17 |
'plain2' => '더보기',
|
|
|
18 |
// 'plain3' => '이젠 전화도
|
|
|
19 |
//로 걸면 무료',
|
|
|
20 |
);
|
|
|
21 |
$params = array(
|
|
|
22 |
'itemData' => $myData,
|
|
|
23 |
'perPage' => 10,
|
|
|
24 |
'delta' => 2,
|
|
|
25 |
'append' => true,
|
|
|
26 |
'clearIfVoid' => false,
|
|
|
27 |
'extraVars' => array_merge($test_strings_plain, $test_strings_encoded),
|
|
|
28 |
'httpMethod' => 'POST',
|
|
|
29 |
'path' => 'http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')),
|
|
|
30 |
'fileName' => basename(__FILE__),
|
|
|
31 |
);
|
|
|
32 |
//var_dump($params['fileName']);exit;
|
|
|
33 |
$pager = & Pager::factory($params);
|
|
|
34 |
$page_data = $pager->getPageData();
|
|
|
35 |
?>
|
|
|
36 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
|
|
|
37 |
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
38 |
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
39 |
<head>
|
|
|
40 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
|
41 |
<title>Pager Test: page <?php echo $pager->getCurrentPageID(); ?></title>
|
|
|
42 |
</head>
|
|
|
43 |
<body>
|
|
|
44 |
<?php echo $pager->links; ?>
|
|
|
45 |
<hr />
|
|
|
46 |
<pre><?php print_r($page_data); ?></pre>
|
|
|
47 |
</body>
|
|
|
48 |
</html>
|