Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

88 lines (58 sloc) 1.977 kb
out(A) ->
{ssi, "", "%%",[{"query", "choosen"}]}.
<div id="entry">
<h2>The query part of the url</h2>
A url can have an optional query part. This part is passed in
the A#arg.querydata which is passed as an argument to the
out/1 function.
<p>We show how to work with the query part of the url through
an example, if we have a URL on the form of
<a href="man.yaws?page=cat"></a>
a key/value pair is passed to the page.
In the above example, we have key=page and its value "cat".
The code in the page man.yaws, will read these key/value pairs
in the A#arg.querydata and display the man page.</p>
Assuming a predifined CSS class called box, defined as:</p>
<div class="box">
<pre> { border: solid; border-width: thin; width: 90%;
background: rgb(211, 211, 211) }
The following code:</p>
out(A) ->
ssi(File) ->
{pre,[], {ssi, File, [],[]}}}.
<p> will display a man page if invoked with a proper key/value
pair in the query part of the URL.</p>
<p> This fairly convenient way of getting at the query (or POST)
is equivalent of the code:</p>
<div class="box">
P = yaws_api:parse_query(A),
L = case lists:keysearch(page, 1, P) of
{value, {page, Page}} ->
<p>The querypart of the URL is part as field in the Arg structure.
The function <tt>parse_query/1</tt> parses the raw data into
a key/value list. </p>
<p>The <tt>queryvar(ARG,Key)</tt> function returns the value of the
variable if it is found in the query part of the request. If the variable is not found
or if the variable is unset, the <tt>queryvar(ARG,Key)</tt> function returns <tt>undefined</tt>.
out(A) -> {ssi, "END2",[],[]}.
Jump to Line
Something went wrong with that request. Please try again.