[pmwiki-users] Different template for individual pages?

Patrick R. Michaud pmichaud at pobox.com
Sat Feb 11 11:07:21 CST 2006


On Fri, Feb 10, 2006 at 03:52:51PM -0700, H. Fox wrote:
> On 2/10/06, Brian Connolly <bconnolly at furthermore.com> wrote:
> > Hagan... Couldn't get that one to work.  DRAT.
> 
> Sorry about that.  I did test it.  Here's the exact clip from my
> config.php file:
> 
> $pagename = ResolvePageName($pagename);
> if ($pagename == 'Main.WikiSandbox') {
>   SDV($Skin, 'pmwiki');
> } else { SDV($Skin, 'light'); }
> 
> It causes the default skin to be applied on the Main.WikiSandbox page only.

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

The difference is simply one of surprise -- an administrator who
already has a $Skin = '...'  line in the config.php might be
surprised when the SDV() code (added to the end of config.php)
seems to have no effect.

Similarly, a farmconfig.php might set a $Skin='...' value, in which
case the SDV() version above would seem to not do anything.

Pm



> > -----Original Message-----
> > From: H. Fox [mailto:haganfox at users.sourceforge.net]
> > Sent: Friday, February 10, 2006 3:58 PM
> > To: Kurt Devlin
> > Cc: Brian Connolly; pmwiki-users at pmichaud.com
> > Subject: Re: [pmwiki-users] Different template for individual pages?
> >
> > On 2/10/06, H. Fox <haganfox at users.sourceforge.net> wrote:
> > > On 2/10/06, Kurt Devlin <kurt.devlin at gmail.com> wrote:
> > > >
> > > > On 2/10/06, Brian Connolly <bconnolly at furthermore.com> wrote:
> > > > > No page at the link you sent.  However, I Googled it and got a rough idea.
> > > >
> > > > Pm left off the trailing 's' in the link. It should be
> > > > http://www.pmwiki.org/wiki/PmWiki/PerGroupCustomizations
> > > >
> > > >  I added a redirect page at the page Pm listed, but I wasn't quick enough
> > > > :-)
> > > >
> > > >
> > > > > So... if I wanted the change the skin on the page Main/KeyIssues,
> > > > >
> > > > > Put a file in /local called KeyIssues.php.  And in it have say...
> > > > >
> > > > >    <?php
> > > > > $Skin = 'red1';
> > > > >     ?>
> > > > >
> > > > > And modify the skin accordingly.
> > > > >
> > > > > Yes?
> > > > >
> > > >
> > > > You got it mostly. To override a specific page, it need to be fully
> > > > qualified, so you'll need a file called Main.KeyIssues.php. Also, it is
> > > > usually recommended to leave off the closing "?>" in the PHP.
> > >
> > > In pmwiki-2.1.beta21 or newer you can do, in config.php,
> > >
> > >     $pagename = ResolvePageName($pagename);
> > >     if ($pagename = 'SomeGroup.SomePage') {
> > >       SDV($Skin, 'red1');
> > >     } else { SDV($Skin, 'blue1'); }
> >
> > Correction: "="  should have been "==".
> >
> >     $pagename = ResolvePageName($pagename);
> >     if ($pagename == 'SomeGroup.SomePage') {
> >       SDV($Skin, 'red1');
> >     } else { SDV($Skin, 'blue1'); }
> >
> > Hagan
> >
> >
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users
> 




More information about the pmwiki-users mailing list