Skip to content
Newer
Older
100644 53 lines (35 sloc) 1.06 KB
21abc5b @klacke Initial revision
authored
1 <erl>
2 out(A) -> file:read_file([A#arg.docroot, "/EXHEAD"]).
3 </erl>
4
5 <h2>Hello world</h2>
6
7 The absoluteley most simple example is a HTML file which doesn't contain
8 any embedded erlang code at all.
9
10 <br>
11 The file <a href="simple_ex1.yaws">simple_ex1.yaws</a> contains the following
12 HTML code.
13 <br>
14
15 <erl>
16 out(A) ->
17 {ok, B} = file:read_file([A#arg.docroot, "/simple_ex1.yaws"]),
18 {ok, ["<xmp> \n", B, "</xmp\n>"]}.
19 </erl>
20
21 <br>
22 Since the file has the suffix <tt>.yaws</tt>, the file will be processed
23 by the Yaws dynamic compiler, but since no embeddded erlang code is found,
24 the data from the file will be delivered untouched.
25 <br>
26
27 <h2> Hello world again </h2>
28
29 The file <a href="simple_ex2.yaws">simple_ex2.yaws</a> contains the following
30 HTML code.
31 <br>
32 <erl>
33 out(A) ->
34 {ok, B} = file:read_file([A#arg.docroot, "/simple_ex2.yaws"]),
35 {ok, ["<xmp> \n", B, "</xmp\n>"]}.
36 </erl>
37
38 The file has one very simple function which just returns a tuple
39 <tt>{ok, String} </tt>
40 <br>
41 The String will be substituted into the delivered HTML data instead of the
42 Erlang code.
43
44
45
46
47
48
49
50
51
52 </html>
Something went wrong with that request. Please try again.