[TYPO3-mvc] paging in listview
Stephan Petzl
spetzl at gmx.at
Thu Apr 8 17:23:24 CEST 2010
Sebastian Schreiber schrieb:
> 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
>
cool, thank you!
--
Best Regards
Stephan Petzl
More information about the TYPO3-project-typo3v4mvc
mailing list