Question
Is it possible to make the value of the SCRIPTURL variable dependent
on the current web?
I would like to use this to host two different domains (
http://www.stratego-language.org
and
http://www.program-transformation.org
) on the same TWiki. When switching from the Stratego web to the Transform web, the URL should
change as well.
Since it is a set variable it cannot be changed in
WebPreferences, but
a mechanism like that would solve the problem.
To clarify the issue: When rendering a
WikiName to HTML, a URL is produced that is relative to the SCRIPTURL variable, i.e., a reference to topic A on page B gets url
% SCRIPTURL %/view/% WEB %/A
What I want to achieve is that a reference
Web1.A on page
Web2.B is rendered as
% SCRIPTURLofWeb1 %/view/Web1/A
This would make it possible to switch between two domains while using the same TWiki.
It is now not possible to achieve this transparently, i.e., by making
scripturl web dependent.
Incidentally, this feature would make it possible to link twikis on different hosts together by cheap wiki linking. If the name of
Web1
is a shortcut for a twiki at a different site, then it is possible
to transparently link to that twiki by just
Web1.A.
- TWiki version: September 2001
- Web server: any
- Server OS: any
- Web browser: any
- Client OS: any
--
EelcoVisser - 31 Oct 2001
Answer:
Moved the question from the TWiki web to the support web.
Not exactly sure what you want to accomplish. May be you could define a new MYSCRIPTURL variable in your
TWiki.TWikiPreferences, and then redefine it in your
WebPreferences?
--
PeterThoeny - 31 Oct 2001
He wants to share the scripts between two virtual hosts and have TWiki retain in the script url the sitename of whatever site the user came from. Good question.
--
MartinCleaver - 05 Nov 2001
Actually, that turns out not to be a problem. Internal links are
rendered relative to the
$scriptUrlPath, i.e.,
/twiki/bin. However, the problem I want to solve is: how to change
HTTP_HOST on switching from one web to another. The code in function
internalLink in
TWiki.pm generates the reference to
theTopic in
theWeb as follows:
$text .= "<a href=\"$scriptUrlPath/view$scriptSuffix/"
. "$theWeb/$theTopic\">$theLinkText<\/a>";
To solve my problem I need to insert some code in front of the url that indicates the webhost to use. the webhost should depend on
theWeb. This somehow involves looking up in a table which host
is associated to which web. I guess the trick is to do this efficiently. I'd happy if someone could point out how to do this in Perl.
--
EelcoVisser - 12 Nov 2001