Using MGI Tags

The proper format of an MGI tag is:

<mgiNameOfTag RequiredParameter="value of parameter" 
RequiredParameter2="value" OptionalParameter1="value" 
OptionalParameter2="value">

Spacing

Note that there is no space between the name of the tag and the opening character and that there is also no space before the closing character (which may occur directly after the tag name or occur after the last parameter, depending on the tag). There is one space between the name of the tag and the first parameter and one space between each parameter. Do not string different parameters together. Do not use tabs. Do not use periods. Keep it simple -- just use single spaces. Within the value of a parameter (enclosed in quotation marks), you may use spaces. For example, there are spaces in the name parameter of this mgiButton tag:

<mgiButton name="Submit Order">

Parameter Format

Each parameter has a specific syntax. A parameter begins with the name of the parameter, followed by an equal (=) sign, followed by the value of the specific parameter within quotation marks. The use of the word "value" in the examples above is just an example and does not indicate an actual option for each parameter. A list of options for all parameters (required and optional) are included in the tutorial for each tag.

Some MGI tags have no required or optional parameters at all. In those cases, all you need is the name of the tag itself enclosed within opening (<) and closing (>) characters. Other tags may have more than one required parameter. In that case, just separate each parameter with a single space. Some tags will have many optional parameters. Again, just separate each parameter that you want to include with a single space.

Most required and optional parameters can also be written in any order. The only thing that has to be specifically placed is the actual name of the MGI tag -- it must go first, immediately following the opening character of the tag.

Case-Sensitivity

MGI tags and parameter names are not case-sensitive -- we use both upper- and lower-case letters in this guide to make the tags easier to read.

File Paths

The value of some MGI parameters is an absolute or relative file path. For absolute file paths, you must provide the full URL to the page (e.g., "http://www.domain.com/folder/page.mgi"). For relative file paths, you must only provide the name of the page (e.g., "page.mgi") or the path to the page in an associated directory (e.g., "folder/page.mgi"). Using MGI, relative paths may reference files below the current directory or above the current directory to the root of the region (e.g., "../page.mgi").

Nesting MGI Tags and HTML Elements

Many MGI tags and HTML elements require a begining and ending tag. When nesting an MGI tag or HTML element within another MGI tag or HTML element, use proper nesting such that the beginning and ending tags match (when required) and the order of beginning and ending tags is correct. Failing to match and order tags and elements can lead to unreliable results.

Incorrect Order:

<font size="+2"><b>Shopping Basket</font></b>

Correct Order:

<font size="+2"><b>Shopping Basket</b></font>

Incorrect Order:

<mgiIf lhs={mgiPostArgument name="email"} 
relationship="isNotEmpty">
<p>Thank you for your application.
<mgiElse>
</p>
<p>The email address is missing.
</mgiIf>
</p>

Correct Order:

<mgiIf lhs={mgiPostArgument name="email"} 
relationship="isNotEmpty">
<p>Thank you for your application.</p>
<mgiElse>
<p>The email address is missing.</p>
</mgiIf>

This Nesting Example is also in the correct order since ending HTML paragraph elements are optional:

<mgiIf lhs={mgiPostArgument name="email"} 
relationship="isNotEmpty">
<p>Thank you for your application.
<mgiElse>
<p>The email address is missing.
</mgiIf>

Non-Matching Beginning and Ending Tags:

<mgiSet name="ID">
  <mgiPostArgument name="name">
<mgiSet name="Type">
  <mgiPostArgument name="custtype">
</mgiSet>

Matching Beginning and Ending Tags:

<mgiSet name="ID">
  <mgiPostArgument name="name">
</mgiSet>

<mgiSet name="Type">
  <mgiPostArgument name="custtype">
</mgiSet>

Coding MGI Tags in HTML Files

MGI tags (like other HTML tags) should be coded using a text editor with raw HTML text files. Even if you use a graphic HTML editor to create web site pages, you should use the raw HTML option or a separate text editor to add MGI tags. For example, MGI tags should be coded in the "HTML Source" view of PageMill and surrounded by NoEdit tags to insure that PageMill does not make automatic corrections or changes to the tags:

<!--NOEDIT--><mgicounter name="homepage"><!--/NOEDIT-->

If MGI tags are added in the graphic view of an HTML editor, the opening and closing tag characters and the quotations marks are often converted from text to HTML character entities (e.g. "&quot;" represents a quotation mark in HTML). MGI cannot be parsed correctly if the tag components are converted to such character entities.


[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]