Background rendering of a web page for email

Matt Neuburg matt at tidbits.com
Sat Mar 23 09:34:44 PST 2002


On Tue, 12 Mar 2002 12:47:43 -0500, Mike Myers <myersm at optonline.net> said:

>In response to a web form submission, I want to render a web page behind the
>scenes, grab the HTML, and mail it to a recipient(s) via tcp.sendMail. The
>HTML returned to the browser is not identical to what gets emailed.
>
>I *could* create the HTML for the email msg entirely from scratch in
>UserTalk, but there are obvious advantages to relying on Frontier's website
>framework to handle the rendering (templates, macros, the glossary). I'm
>trying to arrive at the most simple architecture.
>
>Submit Form 2 --> Render HTML based on selections captured from Forms 1 & 2.
>                  (Need to set some page table elements dynamically.)
>                  Email that HTML to specified recipient(s).
>                  Return some other HTML to browser
>                    eg. a summary, or return to page containing Form 1.
>
>
>I'm unsure of what approach to take in the "behind-the-scenes" rendering
>after submission of Form 2.
>
>  -- if I create a page table dynamically from scratch,
>     can I render it and capture the result string
>     (ala html.buildOnepage())? What are the minimal
>     elements required for a page table to function?

It was exactly to solve this kind of problem that UserLand created
callScript() and thread.callScript(). You get to define a table which you
hand off to the called script a global context. The implications are
staggering.

So to build a page with certain values globally available to the build
process, create a temporary table temptable to serve as the page table,
plunk the globals into a table t, and say:

callscript(@html.buildonepage, {adrPageToBuild, @temptable}, @t)

Problem solved! Now all you have to worry about is the added complication
of threading. What I do is put the above line in a "helper" script called
alsoBuildHelper and call that with thread.callScript():

thread.callscript (@alsobuildHelper, {}, @paramsTable)

This paramsTable is a table that *contains* adrPageToBuild and the table t.
This is a way of handing parameters flexibly to a script that you call why
spawning a thread. m.
-- 

matt neuburg, phd = matt at tidbits.com, http://www.tidbits.com/matt
pantes gar anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/




More information about the Frontier-Users mailing list