Embedding MGI Tags

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

<mgiNameOfTag Parameter={mgiEmbeddedTag ParameterofEmbeddedTag="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 user from a form submission:

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

Information Request Text and MGI Tags


However, 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"> 

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

See the mgiSet and mgiGet tag descriptions for more information.

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