Refactored CMS page-URL accessing to use ->AbsoluteLink(), which can be overridden by defining alternateAbsoluteLink()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41283 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-09-05 06:42:26 +00:00
parent 896e7bfd95
commit 51c1e7ffec

View File

@ -24,6 +24,15 @@ class SiteTree extends DataObject {
return Director::baseURL() . $this->URLSegment . "/$action"; return Director::baseURL() . $this->URLSegment . "/$action";
} }
/**
* Get the absolute URL for this page by stage
*/
public function AbsoluteLink() {
if($this->hasMethod('alternateAbsoluteLink')) return $this->alternateAbsoluteLink();
else return Director::absoluteURL($this->Link());
}
/** /**
* Returns link/current, depending on whether you're on the current page. * Returns link/current, depending on whether you're on the current page.
* This is useful for css styling of menus. * This is useful for css styling of menus.