[pmwiki-users] hot to execute php recipe code after Save button clicked

J. Meijer commentgg at hotmail.com
Sun Aug 20 11:23:04 CDT 2006


> What makes an included file run immediately after someone
clicks the SAVE button while editing a pmwiki page?

> It appears that the mt-blacklist.php file runs when I
start to edit a page and not after I click save.  I am pretty
certain that it should run after the save button is clicked
and not when a person just starts to edit.

> Here is the recipe include syntax.

>   if ($action=='edit') include_once('cookbook/mt-blacklist.php');

> I am trying to figure out this recipe.


I guess you probably found out by now...

The answer:

When the user clicks to edit, the url indeed requests &action=edit, so the recipy above will run. 

Now as long as you stay within the edit mode, up until the final Save, pmwiki will continue to request pages using &action=edit. But upon a Save, an additional parameter is passed: post. When set to true, the page is saved. So while saving, action==edit and post==true, so the above script will run. 

I don't use the specific recipe, but sometimes pmwiki seems to do things backwards. This generally allows the admin to configure the wiki thorugh config.php. 

New users may quickly get lost in pmwiki, because core scripts run without pmwiki.php directly referencing them. They are loaded by scripts/stdconfig.php

HTH,

jm
_________________________________________________________________
Try Live.com: where your online world comes together - with news, sports, weather, and much more.
http://www.live.com/getstarted



More information about the pmwiki-users mailing list