chat.<set <do to/>=
<join "From: " from "
" message
"
____________________________
"
chat.<get to default=""/>/>/><do to/> which just uses the value of the "to" argument
as the name of the field to set.
When computing the value for the new "log" string, we call "join"
to put together who the message is from [the value of the 'from' argument]
the message itself [the value of the 'message' argument]
and the previous value of the log string.
That last value is computed via:
chat.<get to default=""/>
The call to 'get' allows the name of the field to be created programmatically.
In this case, it is just the value of the 'to' argument.
If that field is not present in the 'chat' object, it defaults to "", the empty string.
<class chat> <!-- define the app -->
<method htm_class> .<chat_page/> </method>
<method chat_page from=""=string to=""=string message=""=string>
<if> message.<equal ""/>.<not/>
<do
chat.<set <do to/>=
<join "From: " from "
" message
"
____________________________
"
chat.<get to default=""/>/>/>
chat.<set <do from/>=
<join "To: " to "
" message
"
____________________________
"
chat.<get from default=""/>/>/>
/>
</if>
<body bgcolor=<color red=204 green=255 blue=204/>>
<form action="/chat_page">
<H1> Cheap Chat </H1>
<i>Access via url:</i> http://<do os.<my_ip_address/>/>:9090
<table>
<tr><td>From:</td><td><input name="from" value=from/></td></tr>
<tr><td>To:</td><td><input name="to" value=to/></td></tr>
<tr><td>Message:</td><td> <textarea name="message" value="" rows=5 cols=60/></td></tr>
<tr><td colspan=2><input type="submit" value="Send & Refresh"/></td></tr>
<tr><td>Log: </td><td><textarea rows=15 cols=60 value=chat.<get from default=""/>/></td></tr>
</table>
</form>
</body>
</method>
</class><server chat port=9090/><open_browser_window "http://localhost:9090"/>
<resource "http://localhost:9090"/>.<execute/>
<join "http://" os.<my_ip_address/> ":9090"/>
© Copyright 2006 Clear Methods, Inc.