BUGFIX Added DocumentationPage->getRelativeLink(), which opposing to getRelativePath() excludes the extension

This commit is contained in:
Ingo Schommer 2011-01-13 08:27:25 +00:00
parent 652f7c3898
commit e0c8b6e9e0

View File

@ -108,7 +108,7 @@ class DocumentationPage extends ViewableData {
*/
function Link() {
if($entity = $this->getEntity()) {
$link = Controller::join_links($entity->Link($this->version, $this->lang), $this->getRelativePath());
$link = Controller::join_links($entity->Link($this->version, $this->lang), $this->getRelativeLink());
$link = rtrim(DocumentationService::trim_extension_off($link), '/');
@ -125,6 +125,22 @@ class DocumentationPage extends ViewableData {
return $link;
}
/**
* Relative to the module base, not the webroot
*
* @return string
*/
function getRelativeLink() {
$link = rtrim(DocumentationService::trim_extension_off($this->getRelativePath()), '/');
// folders should have a / on them. Looks nicer
try {
if(is_dir($this->getPath())) $link .= '/';
} catch (Exception $e) {};
return $link;
}
function setFullPath($path) {
$this->fullPath = $path;
}