Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 115 lines (81 sloc) 3.679 kb
ad844e6 @klacke ""
authored
1
2 <erl>
3
4
5 box(Str) ->
6 {'div',[{class,"box"}],
7 {pre,[],Str}}.
8
9 tbox(T) ->
10 box(lists:flatten(io_lib:format("~p",[T]))).
11
12
13 ssi(File) ->
14 {'div',[{class,"box"}],
15 {pre,[],
16 {ssi, File,[],[]}}}.
17
18
19 out(A) ->
20ece13 @klacke more css hackery
authored
20 [{ssi, "TAB.inc", "%%",[{"ssi", "choosen"}]},
ad844e6 @klacke ""
authored
21 {ehtml,
bea8261 @klacke added log_wrap_size, configurable wrap size for all logs, fixed a bug in...
authored
22 {'div', [{id, "entry"}],
23 [
24 {h1, [], "Server side includes (with variable expansion)"},
ad844e6 @klacke ""
authored
25
bea8261 @klacke added log_wrap_size, configurable wrap size for all logs, fixed a bug in...
authored
26 {p, [],
ad844e6 @klacke ""
authored
27 "This feature is useful when we are writing applications where "
28 "basically the entire page is dynamically generated but we also "
dbab7a3 @klacke ssi include with var expansion + docs
authored
29 "want to include snippets of either html or, even more typically,"
ad844e6 @klacke ""
authored
30 " javascript which is almost static, but not quite."},
31
32 {p, [], "In particular the case with dynamically generated javascript "
33 "can get syntactically ugly. So instead of generating strings in "
34 "the erlang code for the javascripts and returning them as "
d02b965 @klacke qnx port + docs overhaul by cschatz@networkadvantage.biz
authored
35 "{pre_html, Data} tuples, it is more beautiful to keep the "
36 "javascript functions in separate files and include them with "
37 "the {ssi ...} return value."},
ad844e6 @klacke ""
authored
38
39 {p, [], "The format of the ssi statement is:"},
40 {br},
41 box("{ssi, File, Delimiter, Bindings}"),
42
43 {p, [],"The ssi structure can occur in two radically different places"
44 " but with identical semantics. It can be a return value in the "
45 " out/1 function and it is a specially treated return value "
46 "in ehtml output, here is an example of an odd return value "
47 "from out/1"},
48
49 tbox([{ssi, "ssi_ex1", "%", [{"a", "gazzonk"}]},
50 {ehtml,
51 [
52 {h1, "a Header"},
53 {ssi, "ssi_ex1", "%", [{"a", "zippo"}]}]}]),
54
55 {p,[], "The file ssi_ex1 contains the following text:"},
56 ssi("ssi_ex1"),
57 {p, [], "And the following ehtml output:"},
58 tbox({ehtml,[{ssi, "ssi_ex1", "%", [{"a", "Godzilla"}]}]}),
59 {p,[], "Generates the following output"},
60 {'div',[{class,"box"}],
61 {pre,[],
62 {ssi, "ssi_ex1", "%", [{"a", "Godzilla"}]}}},
63 {p, [], "And so does the following out/1 function"},
64 box("out(A) -> [{ssi, \"ssi_ex1\", \"%\", [{\"a\", \"Godzilla\"}]}]."),
65 {p,[], "So this is the way to do when we want to embed dynamic content"
66 " deep inside an ehtml structure, but the content isn't representable"
dbab7a3 @klacke ssi include with var expansion + docs
authored
67 " as ehtml. This is typically the case for dynamically generated "
3834150 @klacke gearing up to 1.48 release
authored
68 " javascript as well as dynamically generated java applets."},
69
70 {p, [], "In the above example, \"a\" can be seen as the Variable "
20ece13 @klacke more css hackery
authored
71 "name whereas \"Godzilla\" can be vieved upon as the value "
3834150 @klacke gearing up to 1.48 release
authored
72 "of variable \"a\". It is also possible to have the variable "
73 " value be a complete ehtml structure, not just plain ascii "
74 "strings. Here is an example"},
75
76 box("out(A) ->
77 E = {ehtml, {h1, [], \"Godzillas baby\"}},
78 [{ssi, \"ssi_ex1\", \"%\", [{\"a\", E}]}]."),
79
80
81
82 {h1, [], "yssi, Yaws Server Side Includes"},
83
84 {p, [], "We have a special version of server side includes that we "
85 " call yssi, yaws server side includes. The syntax for this is: "},
86 box("{yssi, YawsFile}"),
87 {p, [], "Yssi can only be used as a return value from the out/1 "
88 " function, never nested into a deep ehtml structure."
89 " Yssi, will perform full yaws expansion on the file named "
90 "YawsFile, i.e (possibly on the fly) compile it, execute it and"
91 " subsequently inject the generated output from the YawsFile."
92 " yssi statements can be arbitrarily deeply recursively nested, that "
93 " is a .yaws file which has been included through an 'yssi' "
94 " statement, may itself contain 'yssi' return values in its "
95 " out/1 function(s) "}
96
97 ]
bea8261 @klacke added log_wrap_size, configurable wrap size for all logs, fixed a bug in...
authored
98 }
3834150 @klacke gearing up to 1.48 release
authored
99 }
100 ].
ad844e6 @klacke ""
authored
101
102
103
104
105
106
107 </erl>
108
109
110 </html>
111
112
113
114
Something went wrong with that request. Please try again.