The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Class THTMLProducer


The class THTMLProducer implements a class for easy creation of HTML pages. It parses an HTML template which contains special HTML tags not recognized by a standard browser. These special tags trigger an OnHTMLTag event which can be used to substitute the special tags by standard HTML code. The replacement code is inserted into the template code instead of the detected special tag.

The special HTML tags show an additional '#' symbol between the opening angle bracket and the name of the tag. For example, the following HTML code uses a special tag to trigger the OnHTMLTag event:
      <#image src="test.gif">
When the template code is parsed this special tag triggers an OnHTMLTag event, which gives the user the opportunity to supply user-defined code (i.e. valid HTML code to display an image) instead of the special tag. Please note, that only spacial tags trigger the OnHTMLTag event, normal HTML tags do not.

The usual way of utilizing THTMLProducer is as follows: first the template code is loaded to the instance by either assigning the code to the Template property, or by reading it from a file or a stream. Next the method Convert is called to convert the template code to the final HTML code. The final code is available both as the return value of the Convert function and the function ConvertedHTMLAsStream. Further, it can be written to disk by calling WriteConvertedHTMLToFile.


Last Update: 2016-Jun-26