Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (54 sloc) 1.936 kB
<erl>
box(Str) ->
{'div',[{class,"box"}],
{pre,[], yaws_api:htmlize(Str)}}.
fpostvar(A, Key) ->
case postvar(A,"lang") of
undefined -> "None";
{ok, Val} ->
Val
end.
out(A) ->
[{ssi, "TAB.inc", [],[]},
{ehtml,
{'div',[{id, "entry"}], [{h2, [],"post.yaws"},
{p,[],[ "This is the ", {tt, [], "post.yaws"}, " file ",
"This yaws file gets invoked with POSTed client data. "
"This is the data that is submitted from the forms page ",
{a, [{href, "form.yaws"}], " form.yaws "}]},
{p, [], ["POST data is naturally organized as a ",
{tt, [], "{Key, Value} "}, " list. A call to "
"the function ", {tt, [], "yaws_api:parse_post(A) "},
" will parse the POSTed data. and return a key/value list "]},
box("
out(A) ->
{ehtml,
{pre, [],
io_lib:format('~p', [yaws_api:parse_post(A)])}}.
"),
{p, [], "Produces the following output"},
box(io_lib:format('~p', [yaws_api:parse_post(A)])),
{p, [], ["The natural way to extract the \"Variables\" from "
" the posted data is to use the function (defined in yaws_api.erl) "
" called ", {tt,[], "postvar(Arg,Key) "}]},
{p, [], "Thus the following erlang code: "},
box("
out(A) ->
{ehtml,
{p,[], [\"The favourite programming language is \",
case postvar(A,\"lang\") of
undefined -> \"None\";
{ok, Val} -> Val
end]}}.
"),
{p,[], "Produces the following output:"},
{hr,[],[]},
{'div',[{class,"box"}],
{p,[], ["The favourite programming language is ",
case postvar(A,"lang") of
undefined -> "None";
{ok, Val} -> Val
end]}}
]}},
{ssi, "END",[],[]}].
</erl>
Jump to Line
Something went wrong with that request. Please try again.