[AppendFile FileName]Text[/AppendFile]

Writes text to the end of an existing file.

To add text to the end of an arbitrary text file, put an [AppendFile] context into a template. AppendFile creates a new file if one does not exist already. All text is put at the end of the file, after any text that may already be there. The file must not be a database file that WebDNA currently has open. See [WriteFile].

Note: AppendFile does not 'understand' databases. If you want to append 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):

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

The text file "SomeTextFile" opens, and the text

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

is written at the end of 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 path to the file, as in "/Some Folder/file.txt" (starting from the web server's root) or "LocalFolder/file.txt" (starting in the same folder as the template file, looking down into a folder called "LocalFolder").

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


"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]


When you use the secure option above, you must also provide the name (or URL path) of the file to create.