|
The GENERATE action causes the results of the current form to be stacked. The current content of the stack is then used as items to replace "variables" in a template HTML page, which is then displayed. The GENERATEC action performs the same function, but then clears the content of the stack once variable substitution has taken place. which will be replaced as the form appears. It is also possible to generate "repeating lines". Imagine a Shopping Cart application, where the user can travel around the presentation, selecting multiple items. Just before he confirms his order you might want him to review all the items he has ordered. To achieve this you need to give all the items the same variable name. You then need to include in your template page two comments that surround the HTML that needs to be repeated the number of times the variable appears in the stack. Define the start of the repeating HTML using a <!--@WCREPEAT@--> comment, and define the end of the repeating HTML with a <!--@WCREPEND@--> comment. WebCompiler will determine the variable(s) that appear in the repeating HTML, and will repeat the HTML, replacing the variable each time with the next value of that variable on the stack, until all the items for that variable have been used. There can be multiple variables with the repeating HTML, and WebCompiler will keep repeating while at least one of those variables has further values. There can also be multiple repeating sections, each enclosed within <!--@WCREPEAT@--> and <!--@WCREPEND@--> comments. You cannot nest these repeating comment markers however. A useful technique is to encase a table row definition inside the repeating markers - the table then grows to the number of rows required to accommodate all the variable values. This is quite complex to grasp. If you need an example, take a look at our "Shopping Cart" example at our Web site at http://www.webcompiler.com and download the source HTML we used to create it. No links are needed to the template HTML page. In fact you probably don't really want any way for the user to access the template page directly. |