[pmwiki-users] creating a lot of similar pages automatically

Petko Yotov 5ko at 5ko.fr
Fri Jun 23 20:40:49 PDT 2023


It looks like you can use an edit template:

   https://www.pmwiki.org/wiki/Cookbook/EditTemplates

Basically, you create a template page with the picture and the initial 
structure of headings.

A picture that is named exactly like the page can be written with a 
variable like this:

   Attach:{*$Name}.jpg

Then you set to config.php:
   $EditTemplatesFmt = 'Site.MyTemplate';

Or, a template in the same group, only applies to new pages in the 
group:
   $EditTemplatesFmt = '{$Group}.Template';

Place your template text in the specified template page.

Now every time you open for editing a page that doesn't exist, it will 
be pre-filled with the template.

See also the Cookbook recipes EditTemplatesMenu if you need to select 
among multiple edit templates, and NewPageBoxPlus where you can preset 
an edit template.


There are also ways to create pages in bulk, but these require some 
knowledge of PmWiki internals and need to be done carefully.

One method creates all linked pages in MyGroup that don't exist when you 
save a page:

$AutoCreate['/^MyGroup\\./'] = array(
   'ctime' => $Now,
   'text' => 'My initial page text',
);

So if you have an index page listing the links to the 170 new pages, and 
edit and save this index page, all linked pages that don't exist will be 
automatically created with the specified initial text.

Petko


On 24/06/2023 01:54, Thomas Hirtenlehner wrote:
> Hi everyone!
> 
> I've several pages who point to about 20+ other pages each. In total
> that's about 170 pages. Those be filled with the same backbone
> information, like a picture (that's named exactly like the page) and
> the same structure of Title and headings.
> 
> doing this for one page is easy, but I'm dreading having to copy/paste
> this another ~170 times.
> 
> Is there a way to create these pages in bulk?
> 
> The only thing I could think of was to put these pages into their own
> group and putting the into into the group header, but this of course
> only gets applied to pages that already exist (and I'd rather keep
> these pages in their original group...)
> 
> Any suggestions are highly appreciated (I'm even grateful about
> conformations that this is not possible, that way I at least can sleep
> again ^^)
> 
> Thomas
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users



More information about the pmwiki-users mailing list