On 17/10/05, ralf-buero(a)kruedewagen.de <ralf-buero(a)kruedewagen.de> wrote:
Good suggestion! But with the {{SERVER}} variable I
can't add
relative links.
[{{SERVER}}/myPage My Page] works
Well, as I said - or intended to - that's basically *equivalent* to a
relative link of the form href="/myPage". Of course, it's relative to
the *server's* idea of your current location, rather than the
browser's, which in most cases isn't significant, but in your case
evidently is.
It's also *not*, in general, equivalent to a relative link of the form
href="myPage", which would refer to a "myPage" in (or relative to)
the
current directory, whereas href="/myPage" (or <FQDN>/myPage) refers to
the root of the server.
[{{SERVER}}../../myPage My Page] doesn't work.
Well, what would that mean? For the English Wikipedia it expands to
"http://en.wikipedia.org../../myPage" which is just nonsense (even if
you fix the broken domain name "en.wikipedia.org..",
"en.wikipedia.org/.." is meaningless anyway).
It seems that a "/" must be the first
character after {{SERVER}}.
Like I say, the {{SERVER}} expands to the "FQDN" (a term I'm using
only because you did) - and a domain name, however fully qualified,
isn't a path; it is, as the variable name suggests, the name of the
server. So, yes, the next thing after the server name has to be a
path, which begins with '/'. Perhaps this is what's confusing you -
"{{SERVER}}" is just a text-substitution for the current server name,
no more and no less.
A second problem (for me):
My SERVER variable is empty ($wgServer=''). This is needed for me
because I am using mediawiki behind a mod_proxy Apache. I want to
hide the FQDN, since this depends on the interface I am using. I have
three IP interfaces in that machine. And the reverse proxy doesn't
like the server name in the URL.
I can't say I entirely understand the situation here - it seems to
imply that there are resources you can never reference, which doesn't
make sense (the requests have got to be going *somewhere*). But I
guess what you mean is that the servername varies on each access, and
you can't necessarily switch between them, so there are no "canonical"
URLs for anything. In which case it seems to me there are, in general,
two solutions:
1) Dynamically determine the currently correct server name, and stuff
$wgServer appropriately. I don't know how feasible this is in your
situation, and although it seems like the nicest solution, you might
have problems with MediaWiki's internal caching anyway ({{SERVER}}
wouldn't necessarily be re-expanded on every request).
2) Implement some new syntax, as you say, to produce "true" relative
links of the form href="foo", where "foo" is arbitrary and not
necessarily a full URI (e.g. it might be "/foo" or "../foo"). [New
syntax, since you don't really want to go round assuming every '[', or
every '/', represents some kind of link]. The easiest way to do that
would be to create an extension - see
http://meta.wikimedia.org/wiki/Write_your_own_MediaWiki_extension.
Basically, this allows you to write a function to turn "<link>foo
bar</link>" into "<a href='foo'
class='external'>bar</a>". I believe
under 1.5, you can do something like <link to="foo">bar</link> as
well
- see
http://meta.wikimedia.org/wiki/MediaWiki_extensions_FAQ#How_can_I_pass_XML-…
--
Rowan Collins BSc
[IMSoP]