[pmwiki-users] Different template for individual pages?

Patrick R. Michaud pmichaud at pobox.com
Tue Feb 14 14:04:37 CST 2006


On Sun, Feb 12, 2006 at 02:23:46PM -0700, H. Fox wrote:
> On 2/11/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> >
> > In general, in a config.php file I think it's better to use '=' instead
> > of SDV() to set variables.  (There are exceptions.)  I would've written
> > the above as:
> >
> >     $Skin = 'light';
> >     $pagename = ResolvePageName($pagename);
> >     if ($pagename == 'Main.WikiSandbox') $Skin = 'pmwiki';
> >
> > Similarly, a farmconfig.php might set a $Skin='...' value, in which
> > case the SDV() version above would seem to not do anything.
> 
> I got the idea to use SDV() from you.  :-)
> 
> http://pmichaud.com/pipermail/pmwiki-users/2005-August/015909.html
> 
> Using SDV() is only advisable under rare circumstances, then?

No, I'm definitely not wanting to imply that.  :-)  SDV() is 
preferred inside of cookbook recipes and the like; I find it to
be much less useful in local customization files.  In the 015909.html
article mentioned above, I suggested SDV because the admin wanted
the farm config to be able to override the local/config.php file,
but I think this is somewhat rare.

Essentially I think of the SDV() function as deferring to the
wishes of other scripts or recipes; while an assignment statement
is more forceful.  Thus, the statement

    SDV($Var, 'XYZ');

says "I'd like for $Var to have the value 'XYZ', but I'm willing to
defer to any settings the admin or another script may have made", while

    $Var = 'XYZ';

says "$Var should have the value 'XYZ', overriding any values another
script may set."

But that's just how I think of it.  Whatever works for each admin
is what they should go with.  :-)

Pm




More information about the pmwiki-users mailing list