Sunday, August 20, 2017 2:53 PM

 

The following is a brief illustration of how MGI works from the programmer (or designer) and web site visitor's perspective.

MGI must be installed on a web server as a plug-in (module) to Apache. MGI cannot run independently of the web server and MGI does not run on the programmer or visitor's personal computer. Usually the web hosting company or web server administrator will perform the installation.

A programmer or designer only needs two things to use MGI - access to a web server running MGI (a server you own or at a hosting company) and a text editor (we recommend BBEdit/TextWrangler for Mac and UltraEdit for PC, although you can use any text editor such as SimpleText or NotePad). In this simple example, we'll assume the programmer wants to display the current time on the page. The programmer

  1. opens a new or existing web page in the text editor
  2. enters the MGI tag to display the time (mgiTime) and any parameters to customize the display (e.g. format and text), and
  3. saves the page with an extension (suffix) that is configured to be processed by MGI.

(Note: the web server administrator can configure one or more extensions to be processed by MGI such as .mgi, .html, .htm, etc. Extensions may be designated by domain or for the entire server.)

The programmer uploads the page with the MGI tag(s) to their web server space. This upload is normally done using an FTP (File Transfer Protocol) program. The page can now be viewed by visitors to the web site.

Visitors type the page into their web browser or click a link to the page. The visitor's page request is routed to the web server. The web server checks the page's extension (suffix). If the extension is configured to be processed by MGI, the web server delivers the entire page (HTML and MGI code) to the MGI application for processing.

The MGI program "reads" the page to find all MGI tags. When it finds a tag, MGI performs the task instructed by the tag and continues "reading" the page until all MGI tags have been found and all tasks have been performed.

Finally, MGI delivers the entire page including any displayed MGI result to the web server, the web server fulfills the request, and the page displays in the visitor's browser.

Of course, all of this happens in just a few milliseconds, but it works something like this: