I would like to request that the Anchor links are relative to the page. The main reason is so that my users can save the pages locally and then use the Anchor links without the browser constantly trying to get online.
I solved this simply by changing the line 1768 in TWiki.pm from
$text .= "<a href=\"$scriptUrlPath/view$scriptSuffix/"
. "$theWeb/$theTopic\#$anchor\">$theLinkText<\/a>";
to
$text .= "<a href=\"\#$anchor\">$theLinkText<\/a>";
Then in the template file I got rid of the base href, and everything seems to work fine.
A desireable side effect is that now themes work within pages, before, everytime I click on an anchor link it would switch back to the default skin, which was very annoying.
Can anyone think of any undesireable side affects to this change, and would it be a good thing to be integrated into the core?
--
AaronPee - 20 Feb 2002
This seems like a good idea, and I can't think of any side effects. In fact, TWiki's use of a BASE HREF element and absolute URLs has caused some problems in the past, see
WhyBaseTag and
RelativeURLs.
I've just written some code to get rid of the BASE tag in locally saved files (see
ReadOnlyOfflineWiki) - if the tag is still there, IE5/IE6 don't handle links to other saved files properly.
--
RichardDonkin - 20 Feb 2002
I just made changes to
WebChangesForAllWebs to get round this problem. Not that using TOC links on any page artived at via a Web.Topic url currently requires reloading because all the TOC links are absolute in Web/Topic format.
I understand the reason for supporting the $web.$topic syntax, but would it have been better implemented as an apache redirect instead of in the code?
--
SamHasler - 29 Jul 2004