[Typo3-dev] How to build absolute URLs?

Ingo Renner typo3 at ingo-renner.com
Tue Jun 28 21:07:38 CEST 2005


Hi all,

as I'm facing this questions the second time today and I still haven't
found a solution I'm asking for your help.

suppose the following, you have some variables like:

$urlParameters = array(
  'tx_ttnews[year]'    => date('Y', $this->tt_news['datetime']),
  'tx_ttnews[month]'   => date('m', $this->tt_news['datetime']),
  'tx_ttnews[day]'     => date('d', $this->tt_news['datetime']),
  'tx_ttnews[tt_news]' => $this->tt_news['uid']
);
you also have the page id in $pid.

Now how to build the absolute URL to this page with these parameters?

A first solution would be the following:
t3lib_div::getIndpEnv('TYPO3_SITE_URL').$this->cObj->getTypoLink_URL($pid,
$urlParameters)

With realurl installed everything is fine and - depending on the realurl
configuration might - return something like this:
http://www.example.com/path/to/pid/news/2005/06/28/i-have-a-question.html

Without realurl this would return in
http://www.example.com/?id=xyz&tt_news[year]=2005&tt_news[month]=06&tt_news[day]=28&tt_news[tt_news]=abc

But as you might have noticed 'index.php' is missing - so I ask for your
advice: How to create absolute URLs?


thanks in advance
Ingo

-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/




More information about the TYPO3-dev mailing list