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 usually consist of text , HTML and/or other MGI tags. For example, this mgiSendMail tag includes a beginning tag with three required parameters, an optional parameter, a body, and an ending tag. In the following example, text and mgiPostArgument tags are included in the body of the mgiSendMail tag.

<mgiSendMail to="info@domain.com" from="webmaster@domain.com" 
subject="Info Request" mailserver="mail.domain.com">

Info Request
************

    Name: <mgiPostArgument name="Name">
 Address: <mgiPostArgument name="Street Address">
    City: <mgiPostArgument name="City">
   State: <mgiPostArgument name="State">
     Zip: <mgiPostArgument name="Zip Code">
   Phone: <mgiPostArgument name="Phone">
   Email: <mgiPostArgument name="Email Address">

Comments: <mgiPostArgument name="Comments">

</mgiSendMail>


[Processing Tags] [Errors] [Writing Tags] [Using Tags] [Embedding Tags]


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]