The mgiRotate Tag

Tag Behavior

Use the mgiRotate tag to randomly rotate the display of a database value, file name, or list item each time a page is served.


Tag Syntax

The mgiRotate tag has three sources. Each source has different required and optional parameters. The sources of mgiRotate are:

  • databaseField - Database field values are randomly rotated.
  • folder - Item names in a folder are randomly rotated. (Note: Hidden files will not be rotated.)
  • itemList - Items in a list are randomly rotated.

DatabaseField Source

The databaseField source of the mgiRotate tag has three required parameters and three optional parameters. The tag form is:

<mgiRotate source="databaseField" databaseName="Database" 
fieldName="Field" odbcDatasource="Source Name" 
odbcUsername="Name" odbcPassword="Password">

Required Parameters:

  • source - The source is the location of the values or items to randomly rotate. The "databaseField" source rotates values from a database field.
  • databaseName - The databaseName is the name of the database that contains the values to rotate.
  • fieldName - The fieldName is the name of the database field that contains the values to rotate.

Optional Parameters:

  • odbcDatasource (NT only) - The odbcDatasource is the name of datasource on the server that provides access information for an external ODBC database. If the odbcDatasource parameter is included, counter information will be stored in the specified ODBC database rather than the internal MGI database. Inquire with the server administrator for additional information about the use of ODBC databases. If you include the odbcDatasource parameter, the odbcUsername and odbcPassword parameters are required.
  • odbcUsername (NT only) - The odbcUsername is the username required to access the ODBC datasource. The odbcUsername parameter is required if you include the odbcDatasource parameter.
  • odbcPassword (NT only) - The odbcPassword is the code required to access the ODBC datasource. The odbcPassword parameter is required if you include the odbcDatasource parameter.

Folder Source

The folder source of the mgiRotate tag has two required parameter and no optional parameters. The tag form is:

<mgiRotate source="folder" folderLocation="Path">

Required Parameters:

  • source - The source is the location of the values or items to randomly rotate. The "folder" source rotates filenames from the specified folder.
  • folderLocation - The folderLocation is the relative path to the folder that contains the filenames to rotate.

Optional Parameters:

  • None.

ItemList Source

The itemList source of the mgiRotate tag needs two of three required parameters and two optional parameters. The tag form is:

<mgiRotate source="itemList" item="Item" 
itemList="Item List" delimiter="Character">

Required Parameters:

  • source - The source is the location of the values or items to randomly rotate. The "itemList" source rotates items from a character delimited list of items.
  • item - The item is one value to rotate. Multiple item parameters may be included in one mgiRotate tag and may be included with itemList parameters. At least one item parameter or one itemList parameter is required.
  • itemList - The itemList is a string of items separated by a character delimiter. Multiple itemList parameters may be included in one mgiRotate tag and may be included with item parameters. At least one item parameter or one itemList parameter is required.

Optional Parameters:

  • delimiter - The delimiter is the character that separates each item in the item list. The default value is a comma. If special reserved characters such as tabs and backslashes are delimiters, you must use the appropriate Escaped String format.


Example Usage and Output

DatabaseField Source

One of the exciting positions now available is
<mgiRotate source="databaseField" databaseName="Jobs" 
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", and in a field named "Position".

Folder Source

<mgiSet name="imageLocation">
   Images/<mgiRotate source="folder" folderLocation="Images">
</mgiSet>
<img src={mgiGet name="imageLocation"}>

In this example, image filenames located in the folder Images are randomly rotated to cause an image to change at random on a web page.

ItemList Source

<mgiRotate source="itemList" item="100" 
itemList={mgiPathArgument mode="returnAllValues"}>

In this example, numerical values from path arguments are randomly rotated with the static value 100.


Suggested Usage

  • Dynamic Content


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]