[pmwiki-users] Edit Template for a group

Tegan Dowling tmdowling at gmail.com
Sun Mar 11 09:48:02 CDT 2007


On 3/10/07, Dr Fred C <drfredc at verizon.net> wrote:
> OK, maybe I just can't read the nose in front of my face.  But I can't
> seem to make any sense of how to make Edit Templates do anything but
> provide a site wide template.  What I need is a template for a specific
> group called "Roster".

On PmWiki/EditVariables, it says

$EditTemplatesFmt
    Name of the page (or an array of names) to be used as the default
text for any newly created pages.

        # Use 'Main.NewPageTemplate' as default text of all new pages
        $EditTemplatesFmt = 'Main.NewPageTemplate';

        # Use 'Template' in the current group for new pages
        $EditTemplatesFmt = '$Group.Template';

        # Use 'Template' in the current group if it exists, otherwise
        # use 'Main.NewPageTemplate'
        $EditTemplatesFmt = array('$Group.Template', 'Main.NewPageTemplate');

The second of these three looks like the one you want.  In
Local/config.php, place
        $EditTemplatesFmt = '$Group.Template';
And create a page in the Roster group named Template, i.e., create
Roster.Template.  Thereafter, new pages in the Roster group will
automatically contain the Template's contents when created.


Note, for more complex rules: I use
       # EditTemplates variable -
http://www.pmwiki.org/wiki/Cookbook/EditTemplates
       # use 'Template' in the current group if it exists,
       # otherwise use 'Templates.{$Name}Template'

       $EditTemplatesFmt =
array('{$Group}.Template','Templates.{$Name}Template');

(While the first part of this enables the exact situation you're
requesting, the second part of this has allowed me to create a
Templates group containing pages SideBarTemplate, GroupHeaderTemplate,
etc, which prepopulate SideBar and GroupHeader pages whenever they're
created in any group.)



More information about the pmwiki-users mailing list