Last active
December 19, 2015 09:29
-
-
Save markuspoerschke/5933531 to your computer and use it in GitHub Desktop.
TYPO3: Using typolink in scheduler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = / |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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