[pmwiki-users] PmForm to create new pages
Oliver Betz
list_ob at gmx.net
Mon May 18 17:25:42 CDT 2009
DaveG wrote:
>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:
you are right, as you write it, I remember where I have been reading
about it...
>(: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);
>}
Thanks for the hint, I didn't know the correct syntax for "require".
"$Conditions['exists']" is already defined in pmwiki.php, so your
suggestion can be simplificated (no php needed):
(:template require if="!exists 'whatever variable'" errmsg="The page
already exists!":)
>> 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.
Are you using (:input text $:entryurl:), IOW PTV markup for the target
page?
I'm using (:input text newname:) and therefore get the same result (?)
by $$something (without ptv_ prefix).
Everything seems to work fine now, thanks!
Oliver
--
Oliver Betz, Muenchen (oliverbetz.de)
More information about the pmwiki-users
mailing list