SimpleTemplate component allows tag replacement
from the sources:
- alp.application file - global values for the application (REPLACE section)
- query string - variables passed through the URL after the "?" sign
- form post - form field values of the posted form
All tags are enclosed in the <% %>. Example tags: <%APPLICATION.Caption%>
or <%QUERY.Field1%>
The tag syntax is:
<%source_name.parameter_name[index]%>
- source_name - can be:
- APPLICATION - parameter_name is searched in the application configuration - see REPLACE section
- QUERY - parameter_name is searched in the parameters passed through the query string.
These are parameters after the "?" sign - for example: alp://.../tml.html-tml?param1=value1¶m2=value2.
- POST - parameter_name is searched in the list of the form field names.
- parameter_name - depends on the source_name part and specifies what
value to use for the tag
- index - is optional and if omitted the first value is used. Example:
the syntax <%QUERY.param1[1]%> leads to the same results as
the <%QUERY.param1%>. It is useful when some of the
parameter/field names has more than one value.
Samples:
Example URL: alp://.../teml.html-tml?A=V1&A=V2&B=V3
Tag <%QUERY.A%> will be replaced with "V1"
Tag <%QUERY.A[2]%> will be replaced with "V2"
Tag <%QUERY.B%> will be replaced with "V3"
Tag <%QUERY.B[1]%> will be replaced with "V3"
If in the local alp.application in the section REPLACE for the html-tml constants are
defined:
(string)A=V1
(string)A=V2
(string)B=V3
Tag <%APPLICATION.A%> will be replaced with "V1"
Tag <%APPLICATION.A[2]%> will be replaced with "V2"
Tag <%APPLICATION.B%> will be replaced with "V3"
Tag <%APPLICATION.B[1]%> will be replaced with "V3"
Remarks:
parameter_name that is not found in the specified source will not be
replaced. <% %> tags are never shown in the browser thus missing values will not
corrupt the visual representation of the page. The same behavior occurs if the index
is out of the range of the available values for the parameter_name. |