Writing MGI Tags

MGI incorporates powerful back-end processing with simple HTML-style tags. No matter how complex those back-end processes are, the tags stay simple and easy to use. To facilitate ease of use, there is a common syntax for all MGI tags.

MGI Tag Syntax

Each MGI tag has three distinct components:

1. Opening and Closing Characters:

Each MGI tag opens with the less than ("<") character and closes with the greater-than (">") character, just like regular HTML tags.

2. Tag Name

The first component of a tag within the opening and closing characters is the name of the tag. That name always starts with "mgi". For instance, the counter tag is <mgiCounter>, the shopping basket tag is <mgiShoppingBasket>, and so forth.

3. Parameters

Some tags have additional components known as parameters. Parameters ("arguments" for those versed in programming) allow you to specify the behavior of an MGI tag. There are two types of parameters: required and optional. Required parameters must always be specified and included with the associated MGI tag.
You can choose to include or not include optional parameters - they are optional, after all! Most optional parameters do, however, have a default behavior that determines how a tag will function if the optional parameter is not specified. For example, if an optional parameter can cause an MGI tag to do one of four things (let's call them 1, 2, 3, and 4), then typically option "1" will be the default behavior. If you do not specify the optional parameter, it will automatically behave as if you had specified option "1". To change the default behavior, you must include the optional parameter and its designated value with the MGI tag. You can also positively indicate that you want the default behavior by including the optional tag and specifying the default behavior.

Some MGI tags consist of two tags, a beginning tag and an ending tag. A beginning tag follows the syntax described above with required and optional parameters. An ending tag always consists of an opening character, a forward slash (/), the name of the MGI beginning tag, and the closing character. The space between a beginning and ending tag is known as the body and can consist of text or other MGI tags. For example, this mgiGuestBook tag includes a beginning tag with one required parameter, a body, and an ending tag. In the following example, text and mgiFieldContent tags are included in the body of the mgiGuestbook tag.

<mgiGuestbook FileLocation="GuestbookLog.html"> 

<mgiFieldContent name="name"> wrote to us and said:
<mgiFieldContent name="comments">
<mgiFieldContent name="name"> can be reached at 
<mgiFieldContent name="email">


[Processing Tags] [Default Home Pages] [Errors] [MGI Data Folder] [Writing Tags] [Using Tags] [Embedding Tags]

[User Guide Main Menu] [Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]