[pmwiki-users] ThisSite and family

Patrick R. Michaud pmichaud at pobox.com
Sun Mar 20 09:50:52 CST 2005


On Sun, Mar 20, 2005 at 04:04:34PM +0100, chr at home.se wrote:
> On Sat, 19 Mar 2005, Patrick R. Michaud wrote:
> 
> > On Tue, Mar 15, 2005 at 11:19:20PM +0100, chr at home.se wrote:
> > > I think it'd be nice if we could use variables in e.g. localmap.txt.
> > 
> > Added for 2.0.beta27.
> 
> Is it documented somewhere? I it's now possible is to write e.g.
> 
> 	SomePrefix	$ThisSite/bla/Ouch
> 
> assuming the PhP-variable $ThisSite exists?

It's not documented anywhere yet; I'm not sure where to document it.
Feel free to add it.  :-)

> Leaving it as a cookbook recipe or script that can be enabled is just fine
> (probably even preferable). There is already a page for ThisSite, e.g.
> 	http://www.pmwiki.org/wiki/Cookbook/ThisSite
> But I think we should add similar stuff for ThisPage, ThisGroup and
> ThisWiki... 

In localmap.txt:

    ThisWiki     $ScriptUrl
    ThisGroup    $ScriptUrl/$Group/
    ThisPage     $PageUrl

although ThisGroup as written here might not work on sites
that don't have $EnablePathInfo set.  I don't know about that one.

> That reminds me -- it would be very convenient to have a
> variable that is guaranteed to always point to the pmwiki-script - it is
> useful when you're using clean URLs for instance.
> 
> What would be a suitable name for such a variable? Maybe we need to
> refactor what variables there are... 

I'm in agreement that we need some refactoring, but I have yet to
come up with a good set.

> If we assume that the URI of the
> current page is 'http://www.pmwiki.org/wiki/Main/Page', perhaps like this?
> 
>  {$Name}	== 'Page'
>  {$Group}	== 'Main'
>  {$Domain}	== 'www.pmwiki.org'
>  {$ScriptPath}	== '/wiki/pmwiki.php'
>  {$WikiPath}	== '/wiki'
>  {$UploadPath}  == '/pmwiki/uploads'

How should the above look if the current page is 
'http://www.pmwiki.org/Main/Page'?  Also, on pmwiki.org at least, 
{$ScriptPath} is in fact '/wiki' and not '/wiki/pmwiki.php'.

The $64,000 question:  How does pmwiki.php reliably figure out
the above values based on the server information it has available?

And please, let's keep the letters "url" in the variable name *somewhere*.
I already have enough issues with admins getting confused about the
difference between variables that specify filesystem locations versus
url locations.

> Ideally we should also define the prefixes in terms of 
> the variables, e.g.
> 	ThisPage: === {$WikiPath}/{$Group}/{$Name}.

Alas, we don't live in an ideal world.  The many various webserver/PHP
configurations (and the issues associated with $EnablePathInfo)
mean that definitions like the one above aren't universally true.
For many sites,

    ThisPage: === {$WikiPath}?n={$FullName}

Pm



More information about the pmwiki-users mailing list