[pmwiki-users] is there a {$ServerUrl} page variable????

Dominique Faure dominique.faure at gmail.com
Fri Jan 19 10:46:59 CST 2007


On 1/19/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Fri, Jan 19, 2007 at 11:09:10AM -0500, Neil Herber (nospam) wrote:
> > I am in the midst of trying to seamlessly migrate a bunch of wikis from
> > one server to another. I have set up the new server to listen on port 81
> > instead of 80 (the default).
> >
> > So the URLs for the new server look like this:
> >
> > > http://neil.eton.ca:81/wiki/index.php/Main/HomePage
> >
> > I need to be able to specify the server URL for the SideBar links where
> > I currently have things like:
> >
> > > * [[http://neil.eton.ca/commoninfo/webmastermail.shtml | Contact Form]]
> >
> > which break because it is missing the port number. (It actually goes to
> > the old server.)
> >
> > How do I do something like this:
> >
> > > * [[{$ServerUrl}commoninfo/webmastermail.shtml | Contact Form]]
>
> How about an InterMap shortcut instead?
>
>     ServerUrl:   http://neil.eton.ca:81/
>
> Then you can have:
>
>     * [[ServerUrl:commoninfo/webmastermail.shtml | Contact Form]]
>
> and when you need to change the port, simply change the InterMap
> entry.
>
> Or, if you know that the "commoninfo/webmastermail.shtml" is
> always going to be on the same server as the wiki, you can use
> the existing "Path:" InterMap shortcut:
>
>     * [[Path:/commoninfo/webmastermail.shtml | Contact Form]]
>
> Here, the string "Path:/" always means "the root directory of
> the current server" (in fact, the above link will be relative, as in
> <a href='/commoninfo/webmastermail.shtml'>...</a> ).
>

BTW, the {$ScriptUrl} var is defined (pmwiki.php:78) as:

$ScriptUrl = $UrlScheme.'://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];

can't we have something like below added to the definition?

if($_SERVER["SERVER_PORT"] != 80 && $_SERVER["SERVER_PORT"] != 443)
  $ScriptUrl .= ':'.$_SERVER["SERVER_PORT"];

Dom




More information about the pmwiki-users mailing list