[TYPO3-mvc] paging in listview

Sebastian Schreiber me at schreibersebastian.de
Thu Apr 8 17:20:22 CEST 2010


Hi Stephan,
i´m using the very flexible pagebrowse extension from Dimtry Dulepov.
For my fluid template I wrote a simple Viewhelper:

--------------------------------------------------------------------------------------------------------------------------------------------

class Tx_SschProductbase_ViewHelpers_PagebrowserViewHelper extends 
Tx_Fluid_Core_ViewHelper_TagBasedViewHelper {

     /**
      *
      * @var string
      */
     const PREFIXID = 'tx_sschproductbase_pi1';

     /**
      * renders a pagebrowser
      *
      * @param integer $totalNum
      * @param integer $resultsPerView
      * @return string $content: The pagebrowser
      */
     public function render($totalNum, $resultsPerView)
     {

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

}

--------------------------------------------------------------------------------------------------------------------------------------------

That´s it.
Hope it helps you

Am 08.04.2010 17:15, schrieb Stephan Petzl:
> hi there!
>
> how do you do paging? has anyone done a pagination class/viewhelper 
> already?
>


-- 
Sebastian Schreiber

Sülzburgstraße 36
D-50937 Köln

T  0221 . 985 13 42
M  0176 431 05 790

Skype schreibersebastian.de

me at schreibersebastian.de
www.schreibersebastian.de

Steuernummer: 219 / 5302 / 2302




More information about the TYPO3-project-typo3v4mvc mailing list