The table below contains example CloudWriter code.  If you want to see the source for the code, click in the Source column.  If you want to see the program executed, click in the Execute column.  If you want to see related HTML source, click in the Execute column and use your browser's View Source option.




Hello, World

This is a simple program demonstrating a way to emit HTML.

example1.cw example1.cw

Hello, World, Redux

This program shows a different way to emit HTML using the Client object.

example2.cw example2.cw

Embedding Expressions

HTML output may contain CW expressions that will be evaluated and emitted to client.

Example2a.cw Example2a.cw

Reading a File

This program reads a file using the GetFile function and sends it to the client as HTML.

example4.cw example4.cw

Replacing Text

Once you've read a file into a string you can scan the string and replace symbols with CW expressions.







Simple Programming

A loop.

example3.cw example3.cw

Calling a Function

This shows that CW programs can be either simple scripts or declarations together with a function call specified in the URL

HelloWorldMain.cw HelloWorldMain.cw?eppfunction=main()


Getting Form Variables

The .html form collects the data.  The data is submitted to a CW program that displays it.

Example6.cw Example 6 HTML

Store a Cookie

This example gets your name from a form.  Then it stores it as a cookie.  Another program is used to retrieve the cookie, demonstrating the persistence of the cookie.

store_a_cookie.cw store_a_cookie.htm

Retrieve a Cookie

This example gets the cookie stored by store_a_cookie.cw.

retrieve_a_cookie.cw retrieve_a_cookie.cw

Send Mail

This example gets your email address and sends you an email!

sendmail.cw SendMail.htm

Database Access

This example opens an existing database and displays the contents.


ODBC Database Access

This example works the same as the previous example but uses ODBC.



Test Code

The non-instructional examples below are used for testing.




Store Some Cookies

Store two cookies values.

store_cookies.cw store_cookies.cw

Retrieve Some Cookies

Retrieve the values stored above and then zero out the cookie values.

get_cookies.cw get_cookies.cw

Encode Cookie

Encode and store a complex cookie value that has arrays and structs.

encode_cookie.cw encode_cookie.cw


John Elkins (john@vermontdatabase.com) 26 Oct 2002