Simple Inline If Comparisons

Example

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

MGI Tags

  • mgiInlineIf

Steps

  1. Open your home page in a text editor .
  2. Insert the mgiInlineIf 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 mgiInlineIf tag.

Insert your cursor in the HTML of your home page where you want the greeting to display. Enter the mgiInlineIf tag, the target parameter, additional required and optional parameters for the target, the "then" parameter, and the "else" parameter. In the target parameter, enter the source of the information for the comparison (Browser, Client, Cookie, Date, Field, Post Argument, Referrer, or Variable). In this example, the source of the comparison is the Date. Specific required and optional parameters are associated with each target (see the tag reference for a complete list). For the date target, one optional parameter is "month". Enter "Jan" for the month parameter. In the "then" parameter, enter the action to perform when the comparison is true. In this example, if the month is "Jan", then display the message "Happy New Year!". In the "else" parameter, enter the action to perform when the comparison is false. If the month is not Jan, display the message "Welcome!".
<mgiInlineIf target="Date" month="Jan" 
then="Happy New Year!" else="Welcome!">

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]