[pmwiki-users] Re: Re: Using relative links and images in url markup

Dominique Faure dominique.faure.1 at free.fr
Mon May 23 01:30:01 CDT 2005


At Monday, May 23, 2005 7:50 AM [GMT+1=CET], chr at home.se wrote:

> On Sun, 22 May 2005, Radu wrote:
>
>> Since (if using clean URLs), authors see stuff like
>> http://path.to/pmwiki/Group/Page, and [[./something.jpg]] would seem to
>> be relative to a directory called Page under Group, under the pmwiki
>> directory.
>
> I'd instead assume that if I'm looking at the page
>
> http://some.site/wiki/Group/Page
>
> then [[./something.jpg]] should refer to
>
> http://path.to/wiki/Group/something.jpg
>
> This is of course most likely bogus, as there will probably be no such
> directory... Anyway, just wanted to explain how I'd interpret
> [[./something]]
>
> I think it'd be better coming up with good prefix names... so if we're
> using e.g. http://site.org/wiki/Group/Page, where pmwiki.php is located
> at http://site.org/wiki/pmwiki.php, we might like something like this:
>
> * wiki: The directory that pmwiki.php resides in, i.e.
> '/wiki/' or 'http://site.org/wiki/'
> * root: The root of the web server, i.e.  '/' or 'http://site.org/'.
> * host: Abslute URI of web server, i.e. 'http://site.org'
> * field: The directory of the current field
>
> cheers
> Christian

So, couldn't we have these prefixes predefined in the intermap mecanism (and 
of course documented...). As regular php datas, they could be helpful also 
to initialize various path/url related config.php parameters like $ScriptUrl 
or $PubDirUrl.
For now, I'm used to have following definitions:

$BaseUrl = "http://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}{"
         . preg_replace("'/$'", '', str_replace('\\', '/', 
dirname($_SERVER['SCRIPT_NAME'])))
         . "}";

...

$ScriptUrl = $BaseUrl .'/'. basename($_SERVER['SCRIPT_NAME']);
$PubDirUrl = $BaseUrl .'/pub';

Regards,
Dominique




More information about the pmwiki-users mailing list