[pmwiki-users] New recipe: PTVInclude

Patrick R. Michaud pmichaud at pobox.com
Tue Apr 17 08:45:17 CDT 2007


On Tue, Apr 17, 2007 at 02:11:05PM +0100, Hans wrote:
> Tuesday, April 17, 2007, 2:04:38 PM, Patrick wrote:
> 
> > Out of curiosity, how is this recipe different from
> > using (:include:) with the basepage option?
> 
> >     (:include TemplateName basepage=PageName:)
> 
> It reads the page, assigns any page text variables found to an array,
> reads the template page, substitutes any {$$name} replacement variables
> in the template with PTV values of PTV "name", and displays the result
> in the place of the markup.
> 
> Can one do this with basename= ?
> basename= is not really documented on PmWiki.IncludeOtherPages

It's another of those 2.2.0-beta features that I haven't had
time/energy to document yet.  If basepage= is provided, then all 
relative links and page variables are interpreted relative 
to basepage.

So, if one creates TemplateName as

    Name: {$:Name}
    Address: {$:Address}

then the directive

    (:include TemplateName basepage=PageName:)

will retrieve the contents of TemplateName, treating any page
variables and links as being relative to PageName.  In particular,
the values for {$:Name} and {$:Address} will be taken from PageName,
but things like {$Title} and {$LastModifiedBy} would also work here.

This assumes that a site has $EnableRelativePageVars enabled,
which will likely be the default in PmWiki 2.2.0 -- currently
$EnableRelativePageVars is disabled by default to help people
that may be upgrading from 2.1.x.

Pm



More information about the pmwiki-users mailing list