Sep 19, 2008

Do you need a page browser for your TYPO3 extension?

I have one for you! Yesterday I uploaded the first version of the "Universal page browser" extension into TER. This extension provides page browsing services to other extensions.

Currently extensions either use their own home made page browser or use default from tslib_pibase. Neither of these solutions is good. Home made page browsers requires time to create and also to maintain. It takes space in the code. The default one is hard to configure, it is not flexible for any modern application. In addition it is table–based, which is not how HTML code should be made these days.

Recently I had to write my own page browser three times in three different extensions and twice used the default one. All these times it was loss of time. If I had a "normal" page browser, I could save on development and debugging.

Armed with this idea I decided to make a page browser that I could use in any other project. I started developing it and then there came one of Netcreators projects, where I could finish this development.

As a result I made a new extension that any other extension case use to integrate a modern highly customizable CSS-based page browser. It is very easy to use. Here is the code:

It is 7 lines (without comments) to get a fully functional page browser for your extension. It provides a tx_yourextkey_pi1[whatevervar] to your extension, takes care about caches, etc. Here is a feature list:

Custom templates are possible

Default CSS–based template available

Customizable number of pages before current and after

The following links can be generated (or switched off):

First page

Previous page

Next page

Last page

There can be indicators that there are more or less pages available that numeric links show (can be switched off)

Extensions can add extra query parameters to the generated page link. These parameters can be generated automatically from TS template using stdWrap

Current query string is automatically appended to the page link

cHash is properly generated

First page does not have a page parameter, which prevents double content issue (SEO–related)

Full detailed manual with all options explained

I am already using this extension privately and I plan to migrate comments extension to use this page browser. So if you need a page browser in your extension, give pagebrowse a try. I am sure you will like it.

hy! this is exactly what i'm looking for, but i can't get it to work. please help! how exactly do i have to place the function and call it? i always get a: "Using $this when not in object context in.." help is much appreciated! thanks * greets Akin

I use your pagebrowser a lot, but also run into this anoying problem all the time. The page links contain contain the GET parameter but not the POST parameter. The only solution I've found so far was by modifying the code and adding '"method" => "POST,GET"' to $queryConf in getPageLink($page). $this->cObj->getQueryArguments() will than also take all POST vars into account.

Page browser is made for flexibility. Adding GET variables is natural behaviour of page browser. POST is a different story because it is a part of CRUD concept, where only POST requests are allowed to modify data. Forcing POST would be inflexible and violate CRUD principles.

In this particular case it is a search form with lots of input fields. The reason for using post is mostly simplicity, because it is much easier to create a link (containing the page id, the language parameter and probably other config linkvars) for the action attribute, than to put all vars (page id, language, cache) into hidden fields. I wonder if there is an elegant way in typo3 to add those basic parameters (page id, etc.) to a custom form?