-2

I want to call base-url for my custom TYPO3 backend module extension. Is there any built in function for that. If not how to configure one constant and call it?

Any Ideas please share.

Note:I'm using TYPO3. 6.2.9

4
  • Can you show the code you currently use? Normally you can use $this->backpath . '/..'.
    – pgampe
    Dec 27, 2014 at 11:33
  • @pgampe I've tried $this->backpath; But it returns NULL
    – Hoja
    Dec 30, 2014 at 6:11
  • since it's BE Module we cant use $GLOBALS['TSFE']->baseurl;
    – Hoja
    Dec 30, 2014 at 6:11
  • Again, please show us your code. How do you register the module, what classes do you extend from, etc.
    – pgampe
    Jan 2, 2015 at 19:54

1 Answer 1

5

Found this as a workaround:

The function is trying to get the baseURL set in config.baseURL. If the baseurl isn't set in the typoscript setup it will use "$_SERVER['SERVER_NAME']" as base.

Maybe it will help..

function loadTS($pageUid) {
    $backendUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Utility\\BackendUtility');
    $rootLine = $backendUtility->BEgetRootline($pageUid);
    $TSObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\TemplateService');
    $TSObj->tt_track = 0;
    $TSObj->init();
    $TSObj->runThroughTemplates($rootLine);
    $TSObj->generateConfig();
    return $TSObj->setup;
} 

$TS = $this->loadTS('1');

!$TS['config.']['baseURL']) 
{ 
    $baseURL = 'http://'.$_SERVER['SERVER_NAME'].'/';
} 
else 
{
    $baseURL = $TS['config.']['baseURL'];
}  
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.