Conditional Comparisons

Example

Displaying the message "Happy New Year!" on your home page during the month of January.

MGI Tags

  • mgiConditional

Steps

  1. Open your home page in a text editor .
  2. Insert the mgiConditional tag.
  3. Save your home page.
  4. FTP your home page to the web server running MGI.
  5. View your home page in a browser.


Step 1: Open your home page in a text editor .

Open your home page in a text editing program that allows you to view and modify the HTML of your page.

Step 2: Insert the mgiConditional tag.

Insert your cursor in the HTML of your home page where you want the greeting to display. Enter the mgiConditional tag, lhs parameter, relationship parameter, rhs parameter, mgiElse tag and ending mgiConditional tag. In the lhs parameter, embed the mgiDate tag for the date comparison. In the relationship parameter, enter "contains". In the rhs parameter, enter "January". In the first body of the mgiConditional tag (between the beginning mgiConditional tag and the mgiElse tag), enter the message to display if the conditional comparison is true. In the second body of the mgiConditional tag (between the mgiElse tag and the ending mgiConditional tag), enter the message to display if the conditional comparison is false.
<mgiConditional lhs={mgiDate} relationship="contains" rhs="January">
Happy New Year!
<mgiElse>
Welcome!
</mgiConditional>

Step 3: Save your home page.

Save the changes you have made to your home page.

Step 4: FTP your home page to the web server running MGI.

Upload your home page from your local computer to the web server using an FTP program.

Step 5: View your home page in a browser.

View your home page in a browser. When you view the home page during the month of January, the message "Happy New Year!" is displayed. When you view the home page during any other month, the message "Welcome!" is displayed.


[Return to the Using If, Then, Else Comparisons Menu]


[User Guide Main Menu] [Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]