[pmwiki-users] Looking for a recipe that creates pages from templates
Hans Bracker
design at softflow.uk
Sat Jun 3 13:46:50 PDT 2023
Hello Simon,
you could probably create a form doing what you want using the Fox formprocessing recipe.
But you are asking for a complex selection process for determining the template for the new page.
A form with a drop-down selection control to choose the right template would be the easiest.
But you are asking for a pre-selection based on evaluating the current page name, if i understand you correctly.
Which means evaluating the page name for some selection criteria must then determine the content of further manual selection via a drop-down control for instance. To incorporate that into a form gets complicated.
Possibly use conditional markup within the form to do the pre-selection evaluation and show the correct drop-down control for further template selection, and having a numb r of those for the various conditional requirements (conditions based on page name evaluation).
Sorry, this is not a solution, just some hints i can think of.
A simple example to select templates (given on same page in anchored sections).
Conditional pre-selection would still need to be added.
Example for FoxNewPageBox, opens new page in edit mode.
If page exists it will jump to target page.
It will load content from a selected template into the new page.
Note that here temp1 is the name of the drop-down input selector, and
template={$FullName}#{$$temp1} will be evaluated when form gets submitted to point to selected choice.
(:fox newpageform template={$FullName}#{$$temp1}:)
Select page template:(:input default temp1 white:)
(:input select temp1 white:)
(:input select temp1 green:)
(:input select temp1 yellow:)
Name of new page:
(:input text newedit size=20:)
(:input submit post "Create Page":)
(:foxend newpageform:)
(:if false:)
[[#white]]
white page
[[#green]]
green page
[[#yellow]]
yellow page
[[#yellowend]]
(:ifend:)
cheers,
Hans
More information about the pmwiki-users
mailing list