typo3系统自带分页代码

        $page = (int)$this->piVars['page'];//跳转第几页
        $page_size = $this->lConf["limit"]?$this->lConf["limit"]:1;   问号是在flexform里面配置的默认一页显示多少条 如果没有配置那么显示如上面我写的1条。

                $ini_door_id = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows("*",$table1,"deleted = 0","","",$page*$page_size.",".($page+1)*$page_size);//对数据库操作做限制
     
        $ini_door_id2 = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows("*",$table1,"deleted = 0");
        $resCount = count($ini_door_id2);//总条数

 

protected function getListGetPageBrowser($rpp,$numberOfItems='0') {
        $numberOfPages = intval($numberOfItems/$rpp) + (($numberOfItems % $rpp) == 0 ? 0 : 1);
        // Get default configuration
        $conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_pagebrowse_pi1.'];
        // Modify this configuration
        $conf += array(
            'pageParameterName' => $this->prefixId . '|page',
            'numberOfPages' => $numberOfPages
        );
        // Get page browser
        $cObj = t3lib_div::makeInstance('tslib_cObj');
        /* @var $cObj tslib_cObj */
        $cObj->start(array(), '');
        return $cObj->cObjGetSingle('USER', $conf);
    }

 $markerArray['###pagebrowser###'] = $this->getListGetPageBrowser($page_size,$resCount);

你可能感兴趣的:(typo3分页)