本文整理汇总了PHP中Varien_Data_Collection::getPageSize方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Collection::getPageSize方法的具体用法?PHP Varien_Data_Collection::getPageSize怎么用?PHP Varien_Data_Collection::getPageSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Collection
的用法示例。
在下文中一共展示了Varien_Data_Collection::getPageSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _addPagingHeaderData
/**
* @param Varien_Data_Collection $collection
* @throws Exception
*/
protected function _addPagingHeaderData(Varien_Data_Collection $collection)
{
$links = array();
$totalCount = $collection->getSize();
$pageSize = $collection->getPageSize();
$totalPageCount = ceil($totalCount / $pageSize);
$currentPage = $collection->getCurPage();
if ($currentPage === null) {
$currentPage = 1;
}
if ($currentPage > 1) {
$links[] = $this->_getPageLink(1, 'first');
$links[] = $this->_getPageLink($currentPage - 1, 'prev');
}
if ($currentPage < $totalPageCount) {
$links[] = $this->_getPageLink($currentPage + 1, 'next');
$links[] = $this->_getPageLink($totalPageCount, 'last');
}
$this->getResponse()->setHeader('Link', implode(", ", $links))->setHeader('X-Total-Count', $totalCount)->setHeader('X-Total-Pages', $totalPageCount)->setHeader('X-Current-Page', $currentPage);
}
示例2: setCollection
/**
* Set collection without manipulating or initializing frame. This would result in inconsistencies
* because the collection is already loaded.
* Instead, use limit that already has been applied on collection.
*
* @param Varien_Data_Collection $collection
* @return $this|Mage_Page_Block_Html_Pager
*/
public function setCollection($collection)
{
$this->_collection = $collection;
$this->setLimit($collection->getPageSize());
return $this;
}