[pmwiki-users] Save and Edit with Preview

Petko Yotov 5ko at 5ko.fr
Wed Jun 10 02:20:00 PDT 2020


On 10/06/2020 10:54, Simon wrote:
> Are the possible values for  $_REQUEST documented?

No, but for the edit form these are the name="..." attributes in that 
HTML form fields.

If something not documented by Pm or by me, it should *not* be 
considered written in stone.

And if it is, it should be considered written in wiki. ;-)

Also, PHP has been known to introduce deprecations and incompatibilities 
with what previously used to work. Also, the $_REQUEST variable may hold 
a different value from one server configuration to another

See:
   https://www.php.net/manual/en/ini.core.php#ini.request-order
   https://www.php.net/manual/en/reserved.variables.request.php

> I want to only preview if I click Save and Edit, I don't want a preview
> when I click Edit
> 
> I'm assuming I need to do something like
> if ($_REQUEST['saveandedit']) {
>      $_REQUEST['preview'] = 1; # preview page on Save and Edit
> }

Almost. It should be more like this:

   if(@$_POST['postedit']>'') {
     $_REQUEST['preview'] = 1;
   }

Petko

> On Tue, 9 Jun 2020 at 08:02, Petko Yotov <5ko at 5ko.fr> wrote:
> 
>> This in config.php:
>> 
>>    $_REQUEST['preview'] = 1;
>> 
>> Note that it always says "Page is unsaved" even when you have pressed
>> "save and edit". That phrase is in Site.EditForm inside a (:if
>> e_preview:) conditional, which only checks if a preview is requested,
>> not if the page was saved.
>> 
>> Petko
>> 
>> On 08/06/2020 21:46, Simon wrote:
>> > Once upon a time I saw some advice on how, when I click save and edit,
>> > I
>> > also get a preview without specifically having to click preview as
>> > well.
>> >
>> > I can't re-locate it, so I'm hoping someone can tell me how to get a
>> > preview  when I click save and edit



More information about the pmwiki-users mailing list