[TYPO3-project-4-3] indexed_search for 4.3

Dmitry Dulepov [typo3] dmitry at typo3.org
Sun Sep 14 21:26:17 CEST 2008


Hi!

Ralf Hettinger wrote:
> * enable result navigation (pagebrowser) that doesn't rely on JavaScript 
> only (e.g. by using [3])

I made a dedicated page browser extension as a part of my work in Netcreators. It is specially developed for use from other extensions. Comments extension will soon migrate to use this new page browser. The extension is not public yet.

You can see something close in functionality here: http://scan.vara.nl/pg.9-8.archief.htm It is *not* my extension there but I got inspiration from this web site. There are first [on/off], previous [on/off], dots-previous [on/off], page list [configurable number of before/after], dots-next [on/off], next [on/off], last links [on/off].

I think more and more to propose the page browser as a new sysext when the extension becomes public. This way we will have common feature reach pagebrowser that can be used by the indexed search too.

Here is a code from one real extension that creates the page browser:

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

As you see from the example, it is really simple. The page browser even uses $this->extPrefix to create a configurable piVar for the current extension. Seven lines of code (without comments) and you have s fully styleable and templateable page browser!

The page browser is also clever enough to make cHashes. It will skip page parameter for the first page and avoid extra page cache entry, which is extra optimization. The only missing thing to the moment is the manual and public status of the extension.

-- 
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/pages/book-reviews/presentation-zen-by-garr-reynolds/


More information about the TYPO3-project-4-3 mailing list