[pmwiki-users] Farms: per-wiki config

Hans design5 at softflow.co.uk
Sat May 10 03:11:58 CDT 2008


Friday, May 9, 2008, 10:28:15 AM, Peter Flynn wrote:

> Is it possible for skins and other per-wiki configs to be managed (ie 
> changed) by each wiki's individual admin via a passworded web interface?

In generally PmWiki needs to be customised via settings in config.php
or other local config files. It has no general admin interface via a
webpage. Especially addition of add-on modules (recipes) need to be
done via config file settings. This is done this way for security
reasons and to allow maximum flexibility.

But meanwhile many things can be done via admin wiki pages.

You mention skins: Generally a skin is set in a config file.
But you could customise your farmconfig.php to allow setting of skins
from wiki pages.

Install http://www.pmwiki.org/wiki/Cookbook/AllGroupHeader in
farmconfig.php. This gives each wiki a page for site-wide markup
inclusions (Site.AllGroupHeader). Perhaps change the new
$GroupHederFmt definition to:

$GroupHeaderFmt =
  '(:include $SiteAdminGroup.AllGroupHeader:)(:nl:)'
  .'(:include $Group.GroupHeader:)(:nl:)';

This makes SiteAdmin.AllGroupHeader the page for wiki-wide markup
inclusions, which is more secure (protected by default).

Add a custom markup to set a skin to farmconfig.php, and restrict use
of it to SiteAdmin.AllGroupHeader:

$pagename = ResolvePageName($pagename);
if ($pagename=='SiteAdmin.AllGroupHeader') {
  Markup('skin', 'fulltext',
    '/\\(:skin\\s+([-\\w]+)\\s*:\\)/e',
    "PZZ(SetSkin(\$pagename,'$1'))");
}

Now you should be able to set a wiki's skin to for example
'TestSkin' with adding
(:skin TestSkin:) to SiteAdmin.AllGroupHeader

Note I have not tested this concept with farmconfig.php!

Another useful addition may be the farm-wide installation of
stylepage.php. See http://www.pmwiki.org/wiki/Cookbook/CSSInWikiPages
Then the wiki styling can be modified via a wiki page.

Another possibility is to control config settings via page text
variables (PTVs):
For instance create a page SiteAdmin.SiteConfig and add to this wiki
page PTVs which will determine configuration settings via associated
conditional code in config.php (or farmwide in farmconfig.php).

Example:

add to the configuration file

switch(PageTextVar('SiteAdmin.SiteConfig', 'Skin')) {
        case 'gemini': $Skin = 'gemini'; break;
        case 'triad' : $Skin = 'triad'; break;
        default : $Skin = 'pmwiki';
}

(make sure you add 'break;' at the end of each 'case' line, otherwise
the 'switch' procedure carries on with the next line!)

and in SiteAdmin.SiteConfig

Skin: triad

or as hidden PTV:

(:Skin: triad:)

It is a lot safer to specify all the options explicitly, rather
than setting
   $Skin = PageTextVar('SiteAdmin.SiteConfig','Skin');

You can expand this concept to control other config settings and even
include recipe scripts.

Again note I have not tested this with farmconfig.php!


  ~Hans




More information about the pmwiki-users mailing list