If, Then, Else Comparisons

Example

Displaying specific banner ads for Mac and Non-Mac browsers on your home page.

MGI Tags

  • mgiIf

Steps

  1. Create two sets of banner ads.
  2. Open your home page in a text editor.
  3. Insert the mgiIf tag.
  4. Save your home page.
  5. FTP your home page to the web server running MGI.
  6. View your home page.


Step 1: Create two sets of banner ads.

Create a set of banner ads that target visitors with a Macintosh browser and a set of banner ads that are not specific to a browser. (See the banner ad tutorial for instructions on creating banner ads).

Step 2: 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 3: Insert the mgiIf tag.

Insert your cursor in the HTML of your home page where you want the banner ads to display. Enter the beginning mgiIf tag, the target parameter, additional required and optional parameters for the target, the mgiElse tag, and the ending mgiIf tag.
 
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 browser. Specific required and optional parameters are associated with each target (see the tag reference for a complete list). For the "browser" target, the "contains" parameter is required. In the "contains" parameter, enter the browser value to compare (e.g., "Mac"). Enter the mgiElse tag. Enter the ending mgiIf tag. Between the beginning mgiIf tag and the mgiElse tag, enter the action to perform when the comparison is true. In the example, a banner ad from the "Mac Banners" set is displayed. Between the mgiElse tag and the ending mgiIf tag, enter the action to perform when the comparison is false. In the example, a banner ad from the "Other Banners" set is displayed.
<mgiIf target="Browser" contains="Mac">
<mgiBannerAd bannerAdSet="Mac Banners">
<mgiElse>
<mgiBannerAd bannerAdSet="Other Banners">
</mgiIf>

Step 4: Save your home page.

Save the changes you have made to your home page.

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

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

Step 6: View your home page.

Access your home page in a web browser. If you are running a Macintosh browser, a banner ad from the Mac Banners set is displayed. When you are running any other browser, a banner ad from the Other Banners set is displayed.

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


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