本文整理汇总了PHP中JPagination::set方法的典型用法代码示例。如果您正苦于以下问题:PHP JPagination::set方法的具体用法?PHP JPagination::set怎么用?PHP JPagination::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPagination
的用法示例。
在下文中一共展示了JPagination::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSet
/**
* This method tests the set method.
*
* @param integer $property The property to set
* @param string $value The value of the property to set
* @param array $expected The expected results for the JPagination object
*
* @return void
*
* @covers JPagination::set
* @dataProvider dataSet
* @since 3.2
*/
public function testSet($property, $value, $expected)
{
$pagination = new JPagination(100, 50, 20, '', $this->app);
$pagination->set($property, $value);
if ($property == 'viewall') {
$result = TestReflection::getValue($pagination, $property);
} elseif (strpos($property, '.')) {
$prop = explode('.', $property);
$prop[1] = ucfirst($prop[1]);
$property = implode($prop);
$result = $pagination->{$property};
} else {
$result = $pagination->{$property};
}
$this->assertEquals($result, $expected, 'The expected output of the property is incorrect');
unset($pagination);
}
示例2:
if ($pagesCurrent + 4 >= $pagesTotal) {
$pagesStop = $pagesTotal;
} else {
$pagesStop = $pagesCurrent + 4;
}
} else {
$pagesStart = 1;
if ($pagesTotal <= 10) {
$pagesStop = $pagesTotal;
} else {
$pagesStop = 10;
}
}
}
}
$pagination->set("limitstart", $limitstart);
$pagination->set("limit", $limit);
$pagination->set("total", $total);
$pagination->set("pagesStart", $pagesStart);
$pagination->set("pagesStop", $pagesStop);
$pagination->set("pagesCurrent", $pagesCurrent);
$pagination->set("pagesTotal", $pagesTotal);
/*echo "<pre>";
print_r($pagination);
echo "</pre>";*/
echo $pagination->getListFooter();
?>
</td>
</tr>
</table>
</div>