This page is still a beta!

1.2. Developer manual

To obtain a path to the page develop should use the following call:

require_once(t3lib_extMgm::extPath('pagepath', 'class.tx_pagepath_api.php'));
$pagepath = tx_pagepath_api::getPagePath($pageId, $parameters);

Page id must be integer value. Parameters can be either an array or a string. If it is a string, it must start from & character. If it is an array, format is the same as for t3lib_div::implodeArrayForUrl() function. The following examples are all valid and equavalent:

$parameters = '&tx_ttnews[tt_news]=123';
$parameters = array('tx_ttnews[tt_news]' => 123);
$parameters = array('tx_ttnews' => array('tt_news' => 123));

The result will be either a fully qualified URL to the page or an empty string (meaning “No URL”).

Important! If there are many web sites in the page tree, the call should be made within the proper web site. For example, if there are example1.com and example2.com, and Backend is open at http://example1.com/, resolving will work correctly only for example1.com. To overcome this limitation, make sure you use TYPO3 4.2.0 or newer and have config.typolinkEnableLinksAcrossDomains=1 in TypoScript setup for all sites.

Technical background

This section describes how path resolving works. It is not necessary to read this section if you only want to use the API.

The API function makes a call to the eID script, which generates proper page path. eID script initializes Frontend environment and uses a call to tslib_cObj::typoLink_URL() to produce the URL. To avoid abusing the service, request is allowed only from the same server IP address. The call is very fast because it does not initialize TYPO3 fully but only part necessary for link generation.