Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 67 lines (54 sloc) 1.875 kB
21abc5b @klacke Initial revision
authored
1 <erl>
2
f448988 @klacke ""
authored
3
b2d5a00 @klacke postvar(), queryvar(), ssi docs
authored
4 box(Str) ->
5 {'div',[{class,"box"}],
f6dbbc9 @klacke added possibility to name the module in a .yaws file
authored
6 {pre,[], yaws_api:htmlize(Str)}}.
b2d5a00 @klacke postvar(), queryvar(), ssi docs
authored
7
8 fpostvar(A, Key) ->
ef3a52a @klacke Removed the atoms in parse_post and parse query, backwards incompatib…
authored
9 case postvar(A,"lang") of
b2d5a00 @klacke postvar(), queryvar(), ssi docs
authored
10 undefined -> "None";
11 {ok, Val} ->
12 Val
13 end.
14
15
16 out(A) ->
bea8261 @klacke added log_wrap_size, configurable wrap size for all logs, fixed a bug…
authored
17 [{ssi, "TAB.inc", [],[]},
b2d5a00 @klacke postvar(), queryvar(), ssi docs
authored
18 {ehtml,
bea8261 @klacke added log_wrap_size, configurable wrap size for all logs, fixed a bug…
authored
19 {'div',[{id, "entry"}], [{h2, [],"post.yaws"},
b2d5a00 @klacke postvar(), queryvar(), ssi docs
authored
20 {p,[],[ "This is the ", {tt, [], "post.yaws"}, " file ",
bea8261 @klacke added log_wrap_size, configurable wrap size for all logs, fixed a bug…
authored
21 "This yaws file gets invoked with POSTed client data. "
b2d5a00 @klacke postvar(), queryvar(), ssi docs
authored
22 "This is the data that is submitted from the forms page ",
23 {a, [{href, "form.yaws"}], " form.yaws "}]},
24
25 {p, [], ["POST data is naturally organized as a ",
26 {tt, [], "{Key, Value} "}, " list. A call to "
27 "the function ", {tt, [], "yaws_api:parse_post(A) "},
28 " will parse the POSTed data. and return a key/value list "]},
29 box("
30 out(A) ->
31 {ehtml,
32 {pre, [],
33 io_lib:format('~p', [yaws_api:parse_post(A)])}}.
34 "),
35
36 {p, [], "Produces the following output"},
37
38 box(io_lib:format('~p', [yaws_api:parse_post(A)])),
39 {p, [], ["The natural way to extract the \"Variables\" from "
40 " the posted data is to use the function (defined in yaws_api.erl) "
41 " called ", {tt,[], "postvar(Arg,Key) "}]},
42 {p, [], "Thus the following erlang code: "},
43 box("
44 out(A) ->
45 {ehtml,
46 {p,[], [\"The favourite programming language is \",
ef3a52a @klacke Removed the atoms in parse_post and parse query, backwards incompatib…
authored
47 case postvar(A,\"lang\") of
b2d5a00 @klacke postvar(), queryvar(), ssi docs
authored
48 undefined -> \"None\";
49 {ok, Val} -> Val
50 end]}}.
51 "),
52
53 {p,[], "Produces the following output:"},
757eca1 @klacke ""
authored
54 {hr,[],[]},
b2d5a00 @klacke postvar(), queryvar(), ssi docs
authored
55 {'div',[{class,"box"}],
56 {p,[], ["The favourite programming language is ",
ffee7fc @klacke some more debug support
authored
57 case postvar(A,"lang") of
58 undefined -> "None";
59 {ok, Val} -> Val
60 end]}}
bea8261 @klacke added log_wrap_size, configurable wrap size for all logs, fixed a bug…
authored
61 ]}},
b2d5a00 @klacke postvar(), queryvar(), ssi docs
authored
62 {ssi, "END",[],[]}].
21abc5b @klacke Initial revision
authored
63
f448988 @klacke ""
authored
64
b2d5a00 @klacke postvar(), queryvar(), ssi docs
authored
65 </erl>
21abc5b @klacke Initial revision
authored
66
Something went wrong with that request. Please try again.