[pmwiki-devel] UpdatePage and HandleEdit
Dominique Faure
dominique.faure at gmail.com
Tue Dec 12 04:02:30 CST 2006
On 12/12/06, Hans <design5 at softflow.co.uk> wrote:
> Tuesday, December 12, 2006, 8:57:37 AM, Dominique wrote:
>
> > Surely because of the assignation:
>
> > $action = 'edit';
>
> > which occurs before the core $action processing, no?
>
> you may be right there.
> But it leaves me with a problem:
> I cannot do this from within a function.
>
> $HandleActions['newaction'] = 'ProcessNewAction';
>
> // called with action=newaction
> function ProcesssNewAction($pagename, $args) {
>
> ....get a page name etc. ....
> ....get some template stuff into $text
>
> if(isset($_POST['newpage'])) {
> ...try to get $text into newpage...
> $pagename = $newpage;
> $action = 'edit'; //does not get me into edit!
> }
> else
> ....we modify the page instead....
> }
>
Using the $HandleActions array makes it run too late in the process stream.
You may then either do the things in the PITS way:
if ($action == 'newaction') {
...
$action = 'edit';
}
but why not try to call HandleEdit yourself?
function ProcesssNewAction($pagename, $args) {
....get a page name etc. ....
....get some template stuff into $text
if(isset($_POST['newpage'])) {
...try to get $text into newpage...
$pagename = $newpage;
HandleEdit($pagename, $args);
}
else
....we modify the page instead....
}
Dom
More information about the pmwiki-devel
mailing list