The mgiFileWrite Tag

Tag Behavior

The mgiFileWrite overwrites into a file the text in the body of the tag. If the file does not exist, it will be created.


Tag Syntax

The mgiFileWrite tag has a beginning tag with no required parameter and three optional parameters, a body, and an ending tag. The tag form is:

<mgiFileWrite folderLocation="" fileLocation="File Path">
MGI tags or text
</mgiFileWrite>

or

<mgiFileWrite folderLocation="New Folder Name" fileLocation="File Path" 
sourceFile="File Name To Copy">

Required Parameters:

  • None.

Optional Parameters:

  • fileLocation="File Path" where "File Path" is the relative path to a target file. If the file does not exist, it will be created with the information in the body of the tag. If the file does exist, its contents will be completely replaced with the information in the body of the tag.
  • folderLocation="New Folder Name" where "New Folder Name" is the name of a folder that is created at the same file level as the page containing the mgiFileWrite tag. A new folder is always created before the file is written, therefore the new folder name can be included in the fileLocation parameter's file path.
  • sourceFile="File Name To Copy" where "File Name To Copy" is the relative path to a source file that is copied to the file location listed in the fileLocation parameter (a relative path refers to the same level of the file structure or below).


Example Usage and Output

<mgiFileWrite fileLocation="event.txt">
New Event: <mgiFieldContent name="Event Box">
</mgiFileWrite>

In this example, the mgiFileWrite tag is used to overwrite the text of a "New Events" page. The event.txt file is then included in another HTML page using the mgiFileInclude tag.


Suggested Usage

  • Form Processing
  • Web Site Maintenance


[Return to the Referencing MGI Menu]


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