Embedding One MGI Tag in a 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 color from a path argument is embedded in the background color of a page and in the comparison value of a conditional statement to determine the text that displays. MGI Tags
Steps
Step 1: Create a link page with path arguments.
<H2><CENTER>Backgrounds and Text</CENTER></H2> <P>Choose a background color to test. The appropriate text color will be shown.</P> <OL> <LI><a href="display.mgi?color=white"> View a white background.</a> <LI><a href="display.mgi?color=black"> View a black background.</a> <LI><a href="display.mgi?color=red"> View a red background.</a> <LI><a href="display.mgi?color=green"> View a green background.</a> <LI><a href="display.mgi?color=orange"> View an orange background.</a> </OL> Step 2: Create a display page and open it in a text editor.
Step 3: Embed the mgiPathArgument tag in the HTML Body tag and the mgiConditional tags.
<HTML> <HEAD> <TITLE>Display</TITLE> </HEAD> <BODY BGCOLOR={mgiPathArgument name="color"}> <CENTER> <P> <mgiIf lhs={mgiPathArgument name="color"} relationship="equals" rhs="white"> The best text color for a white background is black. </mgiIf> <mgiIf lhs={mgiPathArgument name="color"} relationship="equals" rhs="black"> <font color="white">The best text color for a black background is white.</font> </mgiIf> <mgiIf lhs={mgiPathArgument name="color"} relationship="equals" rhs="red"> The best text color for a red background is black. </mgiIf> <mgiIf lhs={mgiPathArgument name="color"} relationship="equals" rhs="green"> <font color="white">The best text color for a reen background is white.</font> </mgiIf> <mgiIf lhs={mgiPathArgument name="color"} relationship="equals" rhs="orange"> The best text color for an orange background is black. </mgiIf> </P> </CENTER> </BODY> </HTML> Step 4: Save the display page.
Step 5: FTP the link page and display page to a web server running MGI.
Step 6: View the link page in a browser and click a link.
|