[Pmwiki-users] Skins, revisited

Patrick R. Michaud pmichaud
Fri Oct 29 14:09:26 CDT 2004


Okay, I think I finally have a handle on skin configuration--here's what
I've ended up with for 2.0.devel20.

The variables for controlling page display are $PageSkinFmt and $PrintSkinFmt.
$PageTemplateFmt and $PrintTemplateFmt are deprecated, but will continue to
be supported for the forseeable future.

$PageSkinFmt can be any of the following:
   - the name of a directory in pub/skins/ containing a screen.tmpl template
   - the name of a template file relative to pub/skins/
   - the name of a template file relative to the current directory (acts
     the same as $PageTemplateFmt in 1.x).

Thus, if pub/skins/myskin/ contains the files for the desired skin, then
one can set:

$PageSkinFmt='myskin';                # uses 'pub/skins/myskin/screen.tmpl' 
$PageSkinFmt='myskin/screen.tmpl';    # same thing
$PageSkinFmt='myskin/blue.tmpl';      # use 'pub/skins/myskin/blue.tmpl'

Within a template, the variable $SkinDirUrl is set to be the url of
the directory containing the template (assuming that $PubDirUrl has
been correctly set).  Thus, a template file can specify something like
'$SkinDirUrl/myskin.css' to refer to the myskin.css file in the same 
URL location/directory as the template.  

Similar rules hold for $PrintSkinFmt, except that if a directory is
specified it will look for a 'print.tmpl' file instead of 'screen.tmpl'.

The result of this is that someone wanting to modify a skin can copy 
*either* the entire directory or just the individual template file to be 
modified, set $PageSkinFmt to the new directory or template file, and 
things "just work".

Also, there's a bonus for people doing WikiFarms:  $PageSkinFmt looks in
both the farm's and field's pub/skins/ directories for the template file,
and sets $SkinDirUrl accordingly.  Thus a farm administrator can 
develop/install a set of common skins that are easily available to each 
of the wiki field administrators.

Finally, cookbook skin authors can now provide skins that simply unpack
into the sites pub/skins/ directory.  For example, if a cookbook skin
has its template stored as fancyskin/screen.tmpl, then enabling the skin
is as simple as

    $PageSkinFmt = 'fancyskin';

in config.php.

Comments, questions, suggestions welcome.  This feature will be released
in 2.0.devel20.

Pm



More information about the pmwiki-users mailing list