[Pmwiki-users] from to creating new page
Knut Alboldt
pmwiki
Thu Nov 4 09:22:10 CST 2004
Patrick R. Michaud wrote:
> On Thu, Nov 04, 2004 at 02:57:00PM +0100, Knut Alboldt wrote:
>
>>#------------------------
>>Markup('createnewpage','directive','/\(:createnewpage\s+(.*):\)/e','Keep(CreateNewPage($pagename,"$1"))');
>>
>>When I enter the new name and submit the form the same page is shown again
>>and the text is replaced by:
>>
>>"newpagename:)(:groupfooter"
>>
>>So what's wrong ?
>
>
> You probably need a question mark after your ".*" in the first pattern.
> Otherwise, ".*" can (and will) include any closing ":)" sequences as
> long as it finds another one to match later in the string.
>
ok, that was the first mistake I made (in this case, there a plenty of others
... :-)
But there has to be something wrong with the form.
#------------------------
Markup('createnewpage','directive','/\(:createnewpage\s+(.*?):\)/e','Keep(CreateNewPage($pagename,"$1"))');
function CreateNewPage($pagename,$newpage)
{
global $ScriptUrl;
$Group = FmtPageName('$Group',$pagename);
$out[] = "<form title='$[creating specified new page in group] $Group'
method='post' action='\$ScriptUrl'>";
$out[] = " <input type='hidden' name='action' value='edit' />";
$out[] = " <input class='formbutton' type='submit' name='post' value='
$[create new page]: ' />";
$out[] = " <input class='formtext' type='text' name='pagename' width='20'
value='$newpage' />";
$out[] = "</form>";
return FmtPageName(implode("\n",$out),$pagename);
}
what I want is to call a new page named $Group + "." + $pagename to be displayed
for editing.
In the upper format of form it displays $Group + ".PageNotFound" but not for
editing (ok, because pmwiki didn't find the new page specified.) Why is the
action=edit passed as an hidden field is ignored ?
And how can I tell that a new page has to be created and displayed for editing
and not "PageNotFound" has to be displayed ? Do I have to implement a new action
(e.g. "newpage" and hanlde the rest within that action ?
Tried it also with method=get / no action='' etc, no chance.
Any help is very welcome !
Knut
More information about the pmwiki-users
mailing list