The mgiRotate Tag

Tag Behavior

The mgiRotate tag randomly rotates the display of a database value, text file or image each time a page is served.


Tag Syntax

The mgiRotate tag has one required parameter and no optional parameters for all sources. In addition, the mgiRotate tag has required parameters for specific sources. The tag form is:

<mgiRotate source="Source">

Required Parameters:

  • source="Source" where "Source" is the location of the information to rotate. Valid sources include "Database", "TextFileFolder", and "ImageFolder". "Database" indicates that the information to rotate is in a database field. The Database source requires three additional parameters (see below for parameter details). "TextFileFolder" indicates that the information to rotate is text files in a folder. The TextFileFolder source requires one additional parameter (see below for parameter details). "ImageFolder" indicates that the information to rotate is images in a folder. The ImageFolder source requires one additional parameter (see below for parameter details).

Database Source Required Parameters:

  • databaseFileLocation="File Path" where "File Path" is the relative path to the database file (at the same level or below) where the information to rotate is located.
  • tableName="Table Name" where "Table Name" is the name of the database table where the information to rotate is located. The table name is case-sensitive.
  • fieldName="Field Name" where "Table Name" is the name of the database field where the information to rotate is located. The field name is case-sensitive.

TextFileFolder Source Required Parameters:

  • folderLocation="File Path" where "File Path" is the relative path to the folder (at the same level or below) that contains the text files to rotate. The text file folder should only contain text files and should not contain other file types.

ImageFolder Source Required Parameters:

  • folderLocation="File Path" where "File Path" is the relative path to the folder (at the same level or below) that contains the image files to rotate. The image folder should only contain image files and should not contain other file types.


Example Usage and Output

Rotating Database Information

One of the exciting positions now available is 
<mgiRotate source="Database" databaseFileLocation="Jobs" 
tableName="Current" fieldName="Position">

In this example, current positions in a job database are randomly rotated in the sentence "One of the exciting positions now available is". The positions are in a database named "Jobs", in a table named "Current", and in a field named "Position".

Rotating Text Files

<mgiRotate source="TextFileFolder" folderLocation="Text/Welcome/">

In this example, welcome messages are randomly rotated on a home page. The welcome messages are located in a folder named "Welcome" that is located in a folder named "Text".

Rotating Images

<mgiRotate source="ImageFolder" folderLocation="FreeBanners">

In this example, free banner ads are randomly rotated at the top of a Links page. The banner ads are located in a folder named "FreeBanners".


Suggested Usage

  • Dynamic Home Pages


[Return to the Referencing MGI Menu]


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