Related Topics . . Invoking User Dynamic Tags . . Creating User Dynamic Tags . . Special Characters in User Dynamic Tags . . Home


Using Dynamic Tags in AppPages

Dynamic tags allow AppPage segments to be shared among multiple AppPages, reducing maintenance requirements and centralizing the source of updates to Web applications. Dynamic tags allow you to specify standard components used in multiple AppPages, such as headers and footers that appear on every AppPage in your Web application. Since dynamic tags are expanded with the AppPage tags by the WebExplode( ) function, changes made to a dynamic tag are automatically applied to all AppPages that include the dynamic tag.

Invoking Dynamic Tags in AppPages

Specify a dynamic tag using the SGML-processing instruction format <?tag_info>. Specify parameters to dynamic tags as tag attributes.

The following example contains the display_image dynamic tag:

  These are the employees in department 20:<HR>
  <CENTER>
  <?display_image NAME=$emp_name DEPT=20>
  </CENTER>

The preceding display_image dynamic tag has two attributes, NAME and DEPT. Dynamic tags accept variables, variable expressions, and constants as parameter values. The COND attribute to AppPage tags is also a valid attribute for a dynamic tag. The COND attribute specifies a condition that is evaluated before the tag is processed. If the condition is true, the tag is processed.

When dynamic tags are encountered in an AppPage, the body of the dynamic tag is substituted for the tag identifier. If you specify a tag within your AppPage that is not defined in the webTags table, no error is generated, and the tag is returned unaffected in the WebExplode( ) function output. The names of the AppPage tags (MISQL, MIVAR, MIBLOCK, MIERROR, MICONNECTION, and MIEVENT) take precedence over the names of dynamic tags.

Creating User Dynamic Tags

User dynamic tag definitions are stored in the webTags table in the database. The webTags schema is shown in the following table.

Column

Description

ID Specifies the unique identifier for the dynamic tag.
parameters Specifies the list of parameters to the dynamic tag.
class Specifies the class of dynamic tag. For example, you can have beginning, expert, or any other class name.
description Specifies the description of the dynamic tag.
content Specifies the body of the dynamic tag.

Parameters in the parameters column are separated by an ampersand ( & ). You can assign a default value to a parameter by specifying the parameter and its value as a name/value pair, for example, param1=value1. A parameter that does not need a default value is specified by the parameter, followed by an equal sign ( = ), with no value following, for example, param1=.

Parameters are delimited by a commercial "at" ( @ ) before and after the parameter name within the body of the dynamic tag.

When a dynamic tag is inserted or updated in the webTags table, the tag is verified to check that all of the parameters in the content column (delimited by the @ character) are also listed in the parameters column. When a dynamic tag is encountered in an AppPage, the tag is verified to check that all parameters requiring a value are assigned a value.

You can add, edit, and delete dynamic tags in AppPage Builder. Following the definition of the dynamic tag, the tag can be invoked in any AppPage.

The following IMG dynamic tag, which invokes the standard HTML IMG tag based on information retrieved in a select statement, displays the image identified by the mandatory SRC parameter. The IMG user dynamic tag also accepts an optional ALIGN parameter.

For example, if your AppPage contains the dynamic tag <?IMG SRC=apb_logo>, sample output to the client is:

  <IMG SRC=/ifmx-bin/wcdrvr.exe?MItabObj=webImages&MIvalObj=apb%5flogo
           &filename=apb%5flogo&MItypeObj=image/gif
  ALT="APB Logo"
  HEIGHT=40
  WIDTH=335>

If your AppPage contains the dynamic tag <?IMG SRC=apb_logo ALIGN=CENTER>, sample output to the client is:

  <IMG SRC=/ifmx-bin/wcdrvr.exe?MItabObj=webImages&MIvalObj=apb%5flogo
           &filename=apb%5flogo&MItypeObj=image/gif"
  ALT="APB Logo"
  HEIGHT=40
  WIDTH=335
  ALIGN=CENTER>

If your AppPage contains the dynamic tag <?IMG SRC=apb_logo COND=$(XST,$DISPLAY)>, the IMG tag is generated only if the DISPLAY variable has been assigned a value within that AppPage.

Note:The body of a dynamic tag can contain another dynamic tag. Do not call the same dynamic tag recursively, or you might consume all your system resources.

Special Characters in Dynamic Tags

You must replace the @ character with its entity reference if the character occurs within your dynamic tag content.

Character

Entity Reference

@ &#64;

Related Topics

AppPage Tags
Using Variables and Variable Expressions in AppPages


Top of Page . . Invoking User Dynamic Tags . . Creating User Dynamic Tags . . Special Characters in User Dynamic Tags . . Home