Typo3 Dev: Get Base URL in Extension

There are two ways to get the base URL in your Code, either you use:

print $GLOBALS['TSFE']->baseUrl;

or from your TypoScript configuration use:

print $GLOBALS['TSFE']->tmpl->setup['config.']['baseURL'];

Be careful, you have to set the baseURL in your TypoScript or both options won’t work at all.

Cheers

  • Digg
  • del.icio.us
  • Facebook
  • Technorati
  • Twitthis
  • FriendFeed

POST A COMMENT

  • You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>