當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Varien_Data_Collection::getPageSize方法代碼示例

本文整理匯總了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);
 }
開發者ID:styladev,項目名稱:magentoStylaConnect,代碼行數:24,代碼來源:V1.php

示例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;
 }
開發者ID:giuseppemorelli,項目名稱:IntegerNet_AttributeOptionPager,代碼行數:14,代碼來源:Pager.php


注:本文中的Varien_Data_Collection::getPageSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。