Function set "Template functions."

Functions used to configure and transfer templates.

Summary

sendTemplate()Configures template file and possibly sends it to the remote end.

Members

sendTemplate()

Configures template file and possibly sends it to the remote end.

sendTemplate( stream, [tpd], [inMemory] )

streamA Falcon stream opened for reading (or a memory string stream).
tpdData for template conversion.
inMemoryWork in memory and return the result instead sending it.
Returns: The configured contents of the file if inMemory is true.
Raises:
IoErroron error reading the file.

This function reads a text as-is (in binary mode) and flushes its contents to the remote side stream.

If a dictionary is set as template conversion data, the data in the file is converted so that strings between a pair of '%' symbols are expanded in the text coresponding to the key in the dictionary. In example, if this is a template file:

   My name is %name%, pleased to meet you!

The %name% configurable text may be changed into "John Smith" throught the following call:

   sendTemplate( InputStream("mytemplate.txt"), ["name" => "John Smith"] )

If a configurable text is not found in the tpd dictionary, it is removed. The specal sequence '%%' may be used to write a single '%'.

Note: Maximum lenght of template configurable strings is 64.


Made with faldoc 2.2.0