Embedding MGI Tags

MGI also supports embedded tags. That is, you can use one MGI tag within the parameter value of another MGI tag or within the parameter value of an HTML tag. The embedded MGI tag replaces the entire value of the MGI or HTML parameter including the quotation marks:

<mgiNameOfTag Parameter={mgiEmbeddedTag Parameter="Value"}>

The syntax of embedded tags is:

1. Opening and Closing Braces

An embedded MGI tag is enclosed by braces (the squiggly ones) as in { }. An embedded MGI tag does not begin with an opening less-than character (<) and does not end with a closing greater-than (>) character.

2. Tag Name

The name of embedded MGI tags does not change.

3. Parameters

You may include an embedded tag's required and optional parameters. The syntax of parameters does not change in the embedded tag.

Embedded tags are often functional and useful. For example, you might replace the "from" parameter of the mgiSendMail tag with a visitor's email address so that you can reply directly to the visitor after their form submission is converted to an email:

<mgiSendMail mailserver="mail.domain.com" to="info@domain.com" 
from={mgiPostArgument name="Email" 
defaultValue="webmaster@domain.com"}
subject="Info Request">

Information Request Text and MGI Tags

</mgiSendMail>

Embedding Multiple Tags

Only one MGI tag can be embedded within the parameter of another MGI tag. An extended embedded function can be achieved using variables. By first setting information in the value of a page or site variable, you can include any combination of text, tags and HTML in the value of a parameter. For example, you may want to include several components in the subject of an mgiSendMail tag. First set the information in the value of a page variable using the mgiSet tag:

<mgiSet name="Email Subject">
<mgiFieldContent name="Product"><mgiFieldContent name="Style"> 
Request
</mgiSet>

Next, embed the value of the page variable in the subject parameter of the mgiSendMail tag using an mgiGet tag:

<mgiSendMail mailserver="mail.domain.com" to="info@domain.com" 
from="webmaster@domain.com" subject={mgiGet name="Email Subject"}>
Information Request Text
</mgiSendMail>

See the mgiSet and mgiGet tag descriptions for more information.

Tags With Bodies

A tag with a body cannot be embedded within another MGI tag or an HTML tag. To embed the value of a tag with a body in another MGI tag or an HTML tag, use the variable method described under Embedding Multiple Tags above.


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