Extbase and RealURL

another day, another problem. Extbase is becoming main framework for TYPO3 extension, because it’s really easy to create a frontend plugin to show (listing or detail view) of a records. Since it’s MVC framework, Extbase create a complex URL for each record.


http://domain.tld/pageName/?tx_extension_plugin[action]=show&tx_extension_plugin[controller]=controllerName&tx_extension_pluginName[param]=9

how to short this?

following “standard” realurl config is normally used to encode the GET parameter to “readable” url path

the config creates following “readable” URL:

http://domain.tld/pageName/urlPath/controller/action/record-title/

but sometimes you used the same term for pageName, urlPath and controller like:

http://domain.tld/job/job/Job/show/my-job-title/

somehow there’s too many “job” in the “readable” URL. how can we spare these repeating paths?
in RealURL there’s a hook to manually influenced the URL en- and decoding. In the RealURL config add following lines

and add our own userFunc like this

the result is a nice short readable URL :)

http://domain.tld/job/my-job-title/

One thought on “Extbase and RealURL”

  1. Within the last year realUrl received an update that takes advantage of htmlspecialchars instead of the old lookup tables. I wasn´t able to find out where german umlauts like “ö” are translated into “oe” and why special characters like “&” (ampersand) are not included. So your approach suited we well enough to come up with a fix for the ampersand being translated into “amp” instead of “und” like our customer would have desired.
    This fix is obvious. Though I spent hours googling for “realurl amp und translation” without any sensible result. Hopefully this helps other german realurl users. Thanks for spending the foundation to this, Kartolo ;)

    $GLOBALS[‘TYPO3_CONF_VARS’][‘EXTCONF’][‘realurl’] = array(
    ‘encodeSpURL_postProc’ => array(‘user_encodeSpURL_postProc’),
    ‘decodeSpURL_preProc’ => array(‘user_decodeSpURL_preProc’)
    );

    function user_encodeSpURL_postProc(&$params, &$ref) {
    $params[‘URL’] = str_replace(‘-amp-‘, ‘-und-‘, $params[‘URL’]);
    }

    function user_decodeSpURL_preProc(&$params, &$ref) {
    $params[‘URL’] = str_replace(‘-und-‘, ‘-amp-‘, $params[‘URL’]);
    }

Leave a Reply

Your email address will not be published. Required fields are marked *