[pmwiki-users] ThisSite and family

chr at home.se chr at home.se
Sun Mar 20 09:04:34 CST 2005


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?

> > I also think ThisSite needs some resurrection, for instance through 
> > {$ThisSite}. 
> 
> Thus far this doesn't seem to be important enough to merit inclusion
> of {$ThisSite} or ThisSite: in the core, so I think I'll leave this 
> for admins to locally enable/customize.

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... 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... 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'

However, I still think ThisPage etc were very clear and easy to understand
as absolute URIs, so I'd probably also like to have:

* ThisPage:   - URI of this page, http://www.pmwiki.org/wiki/Main/Page
* ThisGroup:  - URI of this group, http://www.pmwiki.org/wiki/Main
* ThisDomain: - URI of this domain, http://www.pmwiki.org
* ThisWiki:   - URI of wiki "prefix", http://www.pmwiki.org/wiki
* ThisScript: - URI of wiki script, http://www.pmwiki.org/pmwiki/pmwiki.php
* Uploads:    - URI of attach., http://www.pmwiki.org/pmwiki/uploads
* ThisFarm:   - ???
* ThisField:  - ???

Note that I'm not sure about all of them, especially the farm related
stuff. Anyway, I think it would be convenient to create either a cookbook
recipe or a script that can be enabled, that gives you a set of variables
that spans all paths, as well as a set of prefixes that spans all
interesting URIs. Ideally we should also define the prefixes in terms of 
the variables, e.g.
	ThisPage: === {$WikiPath}/{$Group}/{$Name}.

I don't think I have all the details right in the suggestion above, so 
comments/suggestions are welcome. For instance, should 'ThisPage:' use and 
absolute URI or a relative URI?

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list