Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (35 sloc) 1.21 KB
out(A) -> file:read_file([A#arg.docroot, "/EXHEAD"]).
<h2>Talking to the server</h2>
Since we are running in the same process as the webserver itself, it is
easy for us to interact with the webserver itself from a yaws script.
The following is an example which produces a statistics report
from the webserver. We call the server
The absoluteley most simple example is a HTML file which doesn't contain
any embedded erlang code at all.
out(A) ->
{ok, B} = file:read_file([A#arg.docroot, "/stats_ex1.yaws"]),
{ok, ["<xmp> \n", B, "</xmp\n>"]}.
Since the file has the suffix <tt>.yaws</tt>, the file will be processed
by the Yaws dynamic compiler, but since no embeddded erlang code is found,
the data from the file will be delivered untouched.
<h2> Hello world again </h2>
The file <a href="simple_ex2.yaws">simple_ex2.yaws</a> contains the following
HTML code.
out(A) ->
{ok, B} = file:read_file([A#arg.docroot, "/simple_ex2.yaws"]),
{ok, ["<xmp> \n", B, "</xmp\n>"]}.
The file has one very simple function which just returns a tuple
<tt>{ok, String} </tt>
The String will be substituted into the delivered HTML data instead of the
Erlang code.
Jump to Line
Something went wrong with that request. Please try again.