You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Scott Chapman <sc...@mischko.com> on 2001/05/23 17:44:04 UTC

How to save dynamic HTML output to a file after user reviews it?

I have a situation where I want Embperl to show a user a HTML 
document that is dynamically generated and have the user hit a 
submit button. 

At that point, I want Embperl to save the HTML document to a file.

An alternate method would be to output the HTML to a file at the 
same time as the browser and if the person says "keep it" then 
continue processing, otherwise dump the disk copy.

How is this done? I've read the docs and can't make sense of it.

TIA!
Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: How to save dynamic HTML output to a file after user reviews it?

Posted by Gavin Carr <ga...@openfusion.com.au>.
On Thu, May 24, 2001 at 11:12:24AM +1000, Gavin Carr wrote:
> [- Execute({ inputfile => 'dynamic.ehtml', output => $output, 
>      param => [ 'R' ] }); -]

Whoops, output should be a reference:
 
[- Execute({ inputfile => 'dynamic.ehtml', output => \$output,
      param => [ 'R' ] }); -]

Cheers,
Gavin

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: How to save dynamic HTML output to a file after user reviews it?

Posted by Gavin Carr <ga...@openfusion.com.au>.
Hi Scott,

If it's an embperl page that's producing your dynamic output, one method
would be something like this:

  dynamic.ehtml - dynamic page
  review.ehtml  - review page

--dynamic.ehtml:
[- $review = shift @param -]
[$ if ($review ne 'R') $]<html><body>[$ endif $]

[# Body content goes here. #]

[$ if ($review ne 'R') $]</body></html>[$ endif $]

--review.ehtml:
<html><body>
[$ if ($fdat{op} eq 'Cancel') $]

[# Do something (cancel page or redirect?) #]

[$ elsif ($fdat{op} eq 'Save}) $]

[# Save $fdat{output} to a file, give results page or redirect #]

[$ else $]
[- Execute({ inputfile => 'dynamic.ehtml', output => $output, 
     param => [ 'R' ] }); -]

[+ $escmode = 0; $output +]

<hr>
<form method="post" action="[+ $ENV{SCRIPT_NAME} +]">
<input type="hidden" name="output" value="[+ $output +]">
<input type="submit" name="op" value="Save">
<input type="submit" name="op" value="Cancel">
</form>

[$ endif $]
</body></html>

--

Not tested, of course. :-) Depending on what headers and things you have
in your dynamic page you may need to remove other bits for review
purposes, but you should get the idea.

Hope that helps.

Cheers,
Gavin

On Wed, May 23, 2001 at 08:44:04AM -0700, Scott Chapman wrote:
> I have a situation where I want Embperl to show a user a HTML 
> document that is dynamically generated and have the user hit a 
> submit button. 
> 
> At that point, I want Embperl to save the HTML document to a file.
> 
> An alternate method would be to output the HTML to a file at the 
> same time as the browser and if the person says "keep it" then 
> continue processing, otherwise dump the disk copy.
> 
> How is this done? I've read the docs and can't make sense of it.
> 
> TIA!
> Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org