Dynamic Content FormattingDynamic content formatting commands create dynamic web pages by including variable contents in the HTML code or by conditionally showing or hiding HTML code based on variable content. Commands outputing variables content in the HTTP response have the form: <%varName%> or <%varName oper %> The optional oper modifier may specify a transformation to be applied before including the variable content in the HTTP response. It may be a sympli arithmetic adjustment, a substring operation, an indication that the variable content is already HTML escaped and does not need an additional check, or that the variable content is actually a file name on the web server and that file content must be included in the HTTP response. Commands used to repeat a part of the HTML code for each item in a container variable (arrays, lists, list of arrays) have the form:
<%varName++%> or
<%varName--%> followed by:
..... code to be repeated <%%>
<%varName!%> can be used to output current item <%varName#%> can be used to output current iteration number ..... Commands conditionally including or excluding parts of HTML code have the form: <% condition
%> where condition is something such as varName1==varName2. Other operators can be used to test inequalties, less than, greater than, etc. Items inside container type variables can be addressed folowing the variable name by a numeric index in brackets, e.g. [12], for arrays and lists, or a string key in brackets for a map variable (to get the list of items associated with that key, as in mapVar["abc"]). |
|