[TYPO3-dev] typolink and realurl in eID

Sebastian Gebhard sebastian.gebhard at googlemail.com
Thu Nov 5 17:22:16 CET 2009


Dmitry Dulepov schrieb:
> Hi!
> 
> Sebastian Gebhard wrote:
>> That was what I was thinking about too, but I struggled to find the
>> right realurl function.
> 
> It is not supposed o be called directly. It needs lots of stuff before it can be called.
> 
I just finished that - and you are right: I needed a lot of stuff. Though you posted an extension for this porpuse i'm going
to publish my solution.
It is written for my purpose, so it does not support &type and maybe some other features.
Also notice that my solution is realurl specific, it does not involve the full standard linkbuilding procedure, e.g. CoolURI won't work.

Copy following class, add functionality to main() and edit as neccessary:

<?php

require_once(PATH_tslib.'class.tslib_pibase.php');

class tx_myext_eID extends tslib_pibase{

function init(){

	require_once(PATH_tslib.'class.tslib_content.php');
	require_once(PATH_t3lib.'class.t3lib_page.php');
	require_once(t3lib_extMgm::extPath('realurl').'class.tx_realurl.php');
	tslib_eidtools::connectDB();
	$this->realurl = t3lib_div::makeInstance('tx_realurl');
	$GLOBALS['TSFE']->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
	$GLOBALS['TSFE']->tmpl = t3lib_div::makeInstance('t3lib_TStemplate');
	$GLOBALS['TSFE']->config['config']['tx_realurl_enable'] = 1;
	$this->cObj = t3lib_div::makeInstance('tslib_cObj');

}

function main(){
	$this->init();
	// .. add you functionality here
	// .. for links use $this->geturl($pid, $params) where $params are $key => $value pairs
}

function geturl($pid, $params){
	$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid = '.(int)$pid);
	$pagerow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
	$conf['LD'] = $GLOBALS['TSFE']->tmpl->linkData($pagerow, '', 0, 'index.php', '', t3lib_div::implodeArrayForUrl('',$params);
	$this->realurl->encodeSpURL($conf, $this);
	$url = $conf['LD']['totalURL'];
	return $url;
}

}

$eID = t3lib_div::makeIntance('tx_myext_eID');
$content = $eID->main();
echo $content;
?>


More information about the TYPO3-dev mailing list