Skip to content

Instantly share code, notes, and snippets.

@markuspoerschke markuspoerschke/page.ts

Last active Dec 19, 2015
Embed
What would you like to do?
TYPO3: Using typolink in scheduler
# In your TypoScript you should add the absolute prefix
# or URL would look like this: http://www.example.com/var/www/news/mein-artikel
config.absRefPrefix = /
<?php
// ...
protected function initTsfe() {
global $TYPO3_CONF_VARS;
$id = $this->pageId;
$rootline = t3lib_BEfunc::BEgetRootLine($id);
$host = t3lib_BEfunc::firstDomainRecord($rootline);
$_SERVER['HTTP_HOST'] = $host;
$GLOBALS['TT'] = t3lib_div::makeInstance('t3lib_timeTrack');
$GLOBALS['TT']->start();
$GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe', $TYPO3_CONF_VARS, $id, 0);
$GLOBALS['TSFE']->connectToDB();
$GLOBALS['TSFE']->initFEuser();
$GLOBALS['TSFE']->determineId();
$GLOBALS['TSFE']->initTemplate();
$GLOBALS['TSFE']->getConfigArray();
}
// ...
public function getLink($linkPid) {
$this->initTsfe(); # Call this only once! Move to constructor!
$cObj = t3lib_div::makeInstance('tslib_cObj');
$cObj->typolink_URL(array('parameter' => $linkPid));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.