| Did you know ... | Search Documentation: |
| Pack webconsole -- prolog/webconsole.pl |
The library(webconsole) allows for writing classical query/reply
programs that use a web-browser for I/O. In the typical user scenarion,
the application calls wc_start/0 to open a browser. Next, it calls one
of wc_format/2,3,4 or wc_html/1,2 to send output to the browser and or
calls wc_ask/2,4 to request data from the user.
The home-page can be customized by defining a handler for wc_home. See
wc_home/1 for the default page.
Here is an example run:
?- [library(webconsole)].
?- wc_start. % opens browser
?- wc_format('Hello ~w', [world]).
?- wc_html(p(['Hello ', b(world)])).
?- wc_ask([age(Age)], [p('How old are you'), input([name(age)])]).
Age = 24. % type 24 <enter>
h1 header
The user can customize the output page by defining an HTTP
handler with the id wc_home (see http_handler/3). The
predicate wc_home/1 provides the simple default page.
div element. Multiple output areas can be
created, each with their own id. The default id is
wc_output.
?- wc_format('Hello ~w', [world]).
Options:
true, clear the output area before adding the new
content.?- wc_write([p(['Hello ', b(world)])]).
Options:
true, clear the output area before adding the new
content.ic_error.div holding a form with ID
wc_form. A form-area is used with wc_ask/3 and wc_ask/4.form element. Each Name in the
Result list must be covered by an equally named input element in
the form.
?- wc_ask([ age(Age)
],
[ p('How old are you?'),
input([name(age)])
]).
Age = 24.
The following predicates are exported, but not or incorrectly documented.