BUGFIX: Make AbsoluteLink() return a correct URL even after Director::setBaseURL() has been called.

This commit is contained in:
Sam Minnee 2009-06-18 04:53:14 +00:00
parent 62f8470de4
commit 2916b29287

View File

@ -202,7 +202,10 @@ class SiteTreeSubsites extends DataObjectDecorator {
} }
function alternateAbsoluteLink() { function alternateAbsoluteLink() {
return "http://" . $this->owner->Subsite()->domain() . $this->owner->Link(); // Generate the existing absolute URL and replace the domain with the subsite domain.
// This helps deal with Link() returning an absolute URL.
$url = Director::absoluteURL($this->owner->Link());
return preg_replace('/\/\/[^\/]+\//', '//' . $this->owner->Subsite()->domain() . '/', $url);
} }
} }