[pmwiki-users] SDV and appending to default value

Patrick R. Michaud pmichaud at pobox.com
Wed Sep 20 08:43:57 CDT 2006


On Wed, Sep 20, 2006 at 12:33:43PM +0200, Stefan Schimanski wrote:
> Hi,
> 
> how do I elegantly append something to the $FPLTemplatePageFmt variable
> in a recipe? This variable is defined in pmwiki.php (or more precisely
> scripts/pagelists.php in fact) with the SDV command. So in my recipe, as
> soon as I append something to the array, the default value is lost (as
> SDV will just do nothing). So I have to copy the default value into my
> recipe, which I don't want for obvious reasons. So what I really want is
> to append something to the default value and let the SDV later use my
> modified default value. Any idea?


The $FPLTemplatePageFmt variable assumes that any customization will
set the entire array.  It basically has to, otherwise there wouldn't be
an easy way to eliminate the default entries from the array.

So, for a recipe that wants to add something to $FPLTemplatePageFmt,
it should probably copy the default value into the recipe, as in:

    SDV($FPLTemplatePageFmt, array(
      '{$FullName}', '...recipe custom page...'
      '{$SiteGroup}.LocalTemplates', '{$SiteGroup}.PageListTemplates'));

Yes, this does mean that if PmWiki changes the default value in an
upgrade that the recipe won't match.  I don't expect that to happen.

It also means that if an administrator sets a custom value for
$FPLTemplatePageFmt, then the recipe won't be able to insert its
value into the array.  But if an administrator sets a custom value
for $FPLTemplatePageFmt, it's somewhat assumed that the administrator
is responsible for correctly ordering the entries in $FPLTemplatePageFmt
(exactly as it is when the recipe isn't present).

Pm




More information about the pmwiki-users mailing list