Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

1.3. class.tx_realurl_advanced.php

Introduction

The class tx_realurl_advanced offers advanced encoding of page IDs to paths including encoding in localized titles and cache management.

Configuration

You should create Domain-records on the pages where domains start. Even if you only have one domain, it's a good idea to create a Domain-record for it. There's one thing you should note:

If you have installed TYPO3 in the document-root of a host, you should create a domain-record named like 'www.server.com'. If, on the other hand, your TYPO3-installation is in a different directory, you should create a domain-record named something like 'www.server.com/the_path_to_your_typo'. Slashes at the end don't matter that much.

Configure “realurl” to work with “tx_realurl_advanced” ID encoding

Simply set this configuration for the key “pagePath” in the configuration array:

    'pagePath' => array(

        'type' => 'user',

        'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',

        'spaceCharacter' => '-',

        'languageGetVar' => 'L',

        'expireDays' => 30

    ),

The directives specific for “tx_realurl_advanced” are these:

Directive:

Data Type:

Description:

languageGetVar

string

Defines which GET variable in the URL that defines language id; if set the path will take this language value into account and try to generate the path in localized version.

languageExceptionUids

string

Commalist of UIDs of sys_language records which will not generate a localized URL if languageGetVar is set.

spaceCharacter

Normally, this defaults to an underscore (_), which is used to replace spaces and such in an URL. You can set this to e.g. a hyphen (-) if you want to.

segTitleFieldList

list of fieldnames

The prioritized order of field names from pages table (root line !) that is used when building the speaking URL.

Default is “tx_realurl_pathsegment,alias,nav_title,title”  (for Alternative Page Language records this is only “nav_title, title”).

Notice: If you specify user defined fields which are not currently in root line you will have to add them to the root line via “$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']”

disablePathCache

boolean

Will disable the usage of path cache. The system will rely solely on forward-lookups on the fields in "segTitleFieldList".

autoUpdatePathCache

boolean

(Depends on “disablePathCache” being false!)

If set, the URLs will automatically update themselves after changes to the page title, alias and other fields specified in”segTitleFieldList” and keep track of older values for a period of time corresponding to “expireDays” (see below).

The cost of this feature is that the pathCache is not used for speedy lookups but used for tracking these URLs instead. Thus, performance wise it corresponds to setting “disablePathCache” to zero.

expireDays

integer

The time the old URL of a page whose pagetitle changed will still be remembered (in days). See “autoUpdatePathCache” above. Default is 60 days.

firstHitPathCache

boolean

If set, then the path-cache look up is accepted only if it returns a result in the first hit. It will do so only when no postVarSets are used for the URL.

rootpage_id

integer

This setting is critical for proper functioning of tx_realurl_advanced in the multi domain environment. Its description can be found in  ->pagePath section. In versions prior to 1.0.1 it was specific to tx_realurl_advanced but now it is a realurl setting.

See example below.

encodeTitle_userProc

user function

Additional user processing in “encodeTitle()”.

dontResolveShortcuts

boolean

If set, page shortcuts are not resolved to their destination page.

NB: If you do not set this option the backends Speaking URL Management module will probably report duplicate entries in the pathCache table since both the shortcut page and the destination page will have the same URL entry. The error is in that case not a real problem of course, but annoying to the eye.

excludePageIds

string

Comma list of page ids to exclude from being realurl rendered. The list must NOT contain any spaces between page id numbers!

Example: Configuration of realurl for use on more than one domain in the same database

   1: $TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(

   2:     '_DEFAULT' => array(

   3:         'pagePath' => array(

   4:             'type' => 'user',

   5:             'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',

   6:             'rootpage_id' => 437

   7:         ),

   8:     ),

   9:     'www.test1.intra' => array(

  10:         'pagePath' => array(

  11:             'type' => 'user',

  12:             'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',

  13:             'rootpage_id' => 111

  14:         ),

  15:     )

  16: );

Notice how the rootpage_id field is set differently for these two cases!