Feeds:
RSS
Atom

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:

protected function getListGetPageBrowser($numberOfPages) {
    // Get default configuration
    $conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_pagebrowse_pi1.'];
    // Modify this configuration
    $conf += array(
        'pageParameterName' => $this->prefixId . '|page',
        'numberOfPages' => intval($numberOfPages/$this->conf['pageSize']) +
            (($numberOfPages % $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);
}

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.

Like it? Then bookmark it! digg.comdel.icio.usgoogle.comMyLink.deYahooMyWebTechnoratiFurllive.comnetscapeTagThatWebnews

6 Comments

  1. on Monday, 22-09-08 09:43 Stefan
    Great!

    I will definitly test it soon!


    Thanks in advance,

    Stefan.
  2. on Monday, 22-09-08 11:22 Georg
    Hi!

    Thanks for this ext! I will give it a try with my new extensions like chgallery
  3. on Thursday, 09-10-08 01:26 Andreas Wagner
    Thanks for this great extension! I really hope this will be integrated in the core somehow for 4.3.

    One question: is there a way to get rid of the cHash parameter when you call the extension as USER_INT?

    (By the way, you have some unfilled markers below the archive list to the right: "###ARCHIVE_EMPTY_MSG### | ###COUNT###")
  4. on Friday, 17-10-08 17:00 alex
    hi, sorry, cause i'm not so good in Typo3 but i try to write my first extension..! - I don't know, where can i use this extension in my extension. Can i do write this code in my class.tx_mykey_pi1.php or where?

    I can't find some spezial help for my problem.. - Sorry that i ask here.

    best regards and thx for the book (i'm waiting for the german version)

    alex
  5. on Tuesday, 21-10-08 06:51 Dmitry Dulepov
    alex, read the manual. It is all described there.
  6. on Wednesday, 22-10-08 22:57 Fedir
    If there are any example on the Web ?

Leave a Reply