コード例 #1
0
$datasource = new A_Pager_Array($myarray);
// create pager using values from datasource and request params
$pager = new A_Pager($datasource);
$pager->setRangeSize(5);
$request = new A_Pager_Request($pager);
$request->process();
$writer = new A_Pager_HTMLWriter($pager);
$start_row = $pager->getStartRow();
$end_row = $pager->getEndRow();
$pager2 = new A_Pager($datasource);
$pager2->setPageSize(5);
$pager2->setRangeSize(3);
$pager2->setPageParameter('page2');
$pager2->setPageSizeParameter('page_size2');
$pager2->setLastRowParameter('last_row2');
$request->__construct($pager2);
$request->process();
$writer2 = new A_Pager_HTMLWriter($pager2);
$start_row2 = $pager2->getStartRow();
$end_row2 = $pager2->getEndRow();
$writer->setExtraParameters($writer2->getParameters($pager2->getCurrentPage()));
$writer2->setExtraParameters($writer->getParameters($pager->getCurrentPage()));
$rows = $datasource->getRows($start_row, $end_row);
$n = $start_row;
#echo '<pre>' . print_r($rows, 1) . '</pre>';
echo '<table border="2"><tr><td valign="top">';
echo '<table border="1">';
foreach ($rows as $value) {
    echo '<tr>';
    echo '<td>' . $n++ . '.</td><td>' . $value . '</td>';
    echo '</tr>';