[Pmwiki-users] Re: Skins

Patrick R. Michaud pmichaud
Wed Feb 25 06:13:23 CST 2004


On Tue, Feb 24, 2004 at 04:30:07PM -0800, E. Duncan Scott wrote:
> At first I was very wary of yet another template system, but I'm actually
> finding it quite nice to use.  I do however have a few suggestions.
> 
> At this point the print action isn't so much an action as an application
> of a skin.  It seems like it would be better to pass a skin argument,
> which would work not only for printing, but also for any other installed
> themes. 

Indeed, this is the design of print--a specialized skin--and passing an
arbitrary skin argument is relatively easy to do.  On pmichaud.com 
I have something like the following in my local/config.php:

    $skintemplates = array(
      'pmwiki' => 'pub/skins/pmwiki/pmwiki.tmpl',
      'pmichaud' => 'pub/skins/pmichaud/pmichaud.tmpl',
      'classic' => 'pub/skins/classic/classic.tmpl',
      'jh' => 'pub/skins/jh/jh.tmpl');

    if (@$_GET['skin']) $PageSkin=$_GET['skin'];

    if ($skintemplates[$PageSkin]) $PageTemplateFmt=$skintemplates[$PageSkin];

This sets the page's skin based on a ?skin argument.  So, if you jump
to http://www.pmichaud.com/wiki/PmWiki/PmWiki?skin=classic, you see
the page in the classic skin.  I've even been able to set a cookie to
keep the skin change for all other pages, but I have that customization
turned off at the moment.

> That or add the abiltiy for skins to have multiple templates that
> vary based on the action being performed.  

This can also be done from local/config.php:

   if ($action=='edit') $PageTemplateFmt = 'pub/skin/myeditskin.tmpl';
   if ($action=='upload') $PageTemplateFmt = 'pub/skin/myuploadskin.tmpl';

> This would probably require
> some standardization of the template names, which brings me to my other
> point.  [...]   Perhaps a structure like this would work.
> 
> pub/skins/pmwiki/default.tmpl
> pub/skins/newskin/browse.tmpl
> pub/skins/newskin2/default.tmpl

One of the problems about creating structures that do things "automatically"
on behalf of the admin is that it increases the learning curve to understand
all of the pieces and parts of the system.  Wish I had remembered this
when designing the 0.6.0 layout :-( .  So, I think that a simple system is
better, along with the power to add capability as it's needed.  I could
be wrong, but I think most admins will find it easier to understand the
two "if" statements I wrote above than to figure out where the "browse",
"edit", "upload", etc. templates should go and what they should be named
(and why it's not working if they're named wrong).

So, if the PmWiki community develops a standard convention for naming
of skin templates, I'm all in favor of it, but for now I think it best
to let it evolve from the simpler system a bit.

I'll write up a script that people can install to switch skins
via a ?skin argument and put the script in the Cookbook.

Pm



More information about the pmwiki-users mailing list