registerArgument('page', 'int', "The page's number", true); $this->registerArgument('nocache', 'int', "If true, adds a no_cache parameter to the query", false, 1 ); } /** * -- This method is expected by Fluid -- * Renders the content as html * * @param array $arguments * @param Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * @return string */ public static function renderStatic( array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext ) { $page = $arguments['page']; $nocache = $arguments['nocache']; $request = $GLOBALS['TYPO3_REQUEST']; $uri = $request->getUri(); $query = $uri->getQuery(); if (preg_match("/.*page=\d+.*/", $query)) { $query = preg_replace( "/page=\d+/", "page=" . $page, $query ); } elseif ($query != '') { $query .= "&page=" . $page; } else { $query .= "page=" . $page; } $query = preg_replace("/&no_cache=1/", "", $query); if ($nocache) { $query .= '&no_cache=1'; } return (string)$uri->withQuery($query); } }