Embedding Multiple Tags in One ParameterIntroductionMGI 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. Embedding allows you to create "dynamic" functions that change depending on the information entered or calculated. Only one MGI tag can be embedded within the parameter of another MGI tag unless you use variables for an extended embedded function. In this example, the subject of a referral email is constructed from the visitor's name and message. MGI Tags
Steps
Step 1: Create a referral form.
<FORM action="referralprocess.mgi" method="post"> <H2><CENTER>Refer Our Site</CENTER></H2> <P><CENTER>Refer our site to a friend. Complete the form below and click "Send Now".</CENTER></P> <P><CENTER> <TABLE BORDER="0" CELLSPACING="3" CELLPADDING="0"> <TR> <TD ALIGN="RIGHT">Your Name:</TD> <TD> <INPUT NAME="SenderName" TYPE="text" SIZE="30"></TD> </TR> <TR> <TD ALIGN="RIGHT">Your Email:</TD> <TD> <INPUT NAME="SenderEmail" TYPE="text" SIZE="30"></TD> </TR> <TR> <TD ALIGN="RIGHT">Friend's Name:</TD> <TD> <INPUT NAME="RecipientName" TYPE="text" SIZE="30"></TD> </TR> <TR> <TD ALIGN="RIGHT">Friend's Email:</TD> <TD> <INPUT NAME="RecipientEmail" TYPE="text" SIZE="30"></TD> </TR> <TR> <TD ALIGN="RIGHT">Subject:</TD> <TD> <INPUT NAME="Subject" TYPE="text" SIZE="30"></TD> </TR> <TR> <TD ALIGN="RIGHT">Message:</TD> <TD> <TEXTAREA NAME="Message" ROWS="7" COLS="27"> </TEXTAREA></TD> </TR> <TR> <TD> </TD> <TD><P><CENTER> <INPUT TYPE="submit" VALUE="Send Now"></CENTER></TD> </TR> </TABLE></CENTER> </FORM> Step 2: Create a referral processing page and open it in a text editor.
Step 3: Construct the subject in a variable and embed the variable in the mgiSendMail tag.
<H2><CENTER>Referral Submission</CENTER></H2> <P><CENTER>Your referral has been sent to <mgiPostArgument name="RecipientName"> </CENTER></P> <mgiSet name="FullSubject"> <mgiPostArgument name="SenderName"> says <mgiPostArgument name="Subject"> </mgiSet> <mgiSendMail to={mgiPostArgument name="RecipientEmail"} from="info@domain.com" replyTo={mgiPostArgument name="RecipientEmail"} mailServer="mail.domain.com" subject={mgiGet name="FullSubject"}> Dear <mgiPostArgument name="RecipientName">, <mgiPostArgument name="SenderName"> thought you might be interested in our web site. <mgiPostArgument name="Message"> </mgiSendMail> Step 4: Save the referral processing page.
Step 5: FTP the referral form and referral processing page to a web server running MGI.
Step 6: View the referral form in a web browser and submit the referral.
Dear Andrea Shuster, Mark Willis thought you might be interested in our web site. Hey Andrea, check out this site. They have some great holiday deals. Buy me something nice :) |