[WriteFile FileName]Text[/WriteFile]
Writes the specified text to a file, replacing any previous text.

To write text to an arbitrary text file, put a [WriteFile] context into a template. WriteFile creates a new file if one does not exist already, and erases any existing text if the file was already there. The file should not be a database file WebDNA currently has open. See [AppendFile].

Note: WriteFile does not 'understand' databases. If you want to write a new record to the end of a database, use Append instead.

Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):

[WriteFile SomeTextFile]Hello, my name is Grant. The time is [time]
This is a second line[/WriteFile]

The text file "SomeTextFile" is created and opened, and the text:

Hello, my name is Grant. The time is 13:43:01
This is a second line

is written to the file. Notice that carriage returns inside the context are written to the file exactly as they appear. Also notice that any WebDNA [xxx] tags inside the context are substituted for their real values before being written to the file. You may specify a full or partial URL to the file, as in "/Some Folder/file.txt" or "LocalFolder/file.txt."

Security Note: By default, all files created by WebDNA are tagged with a special code telling WebSTAR not to display them via URL. If you want files to be visible to outside browsers, use the optional settings below.

Parameter Description
secure
"T" for files that should be secure -- WebSTAR will not display them.
"F" for files that should be visible via URL -- WebSTAR will display them.
Example: [WriteFile secure=F&file=SomeFile]...[/WriteFile]
file
When you use the secure option above, you must also provide the name (or URL path) of the file to create.