[pmwiki-users] PmForm to create new pages

DaveG pmwiki at solidgone.com
Mon May 18 14:51:29 CDT 2009

Oliver Betz wrote:
> two questions reagarding PmForm as "new page" tool:
> How can I request that the page doesn't yet exist? The :template
> require:) markup isn't extensively documented.
Again, you might want to check how BlogIt handles this :) In summary:
(:template require $:entryurl if="!bi_ispage '{$$ptv_entryurl}'" 
errmsg="$[Pagename already exists, or is invalid/blank]":)

And then bi_ispage is a condition which calls a function:
$Conditions['bi_ispage'] = 'bi_IsPage($condparm)';
function bi_IsPage($pn){
	$mp = MakePageName($GLOBALS['pagename'], $pn);
	if (empty($mp)) return true;
	if ($mp==$GLOBALS['pagename']) return false;
	return PageExists($mp);

> Is it the correct method to pass the target page name as variable and
> use a line like
>  (:template defaults saveto={$$mygroup}.{$$newname} :)
> to use it?
In Site.ClogIt-CoreTemplate#blog-post-control I use this format:
   (:template defaults saveto="{$$ptv_entryurl}":)

Where entryurl is the name of the PmForm variable in which the user 
enters the pagename.

Hope that helps.

  ~ ~ Dave

More information about the pmwiki-users mailing list