A MapGuide Server Page (MSP) is any PHP, ASP.NET, or JSP page that makes use of the MapGuide Web API. MSPs are typically invoked by the MapGuide Viewer or browser and when processed result in HTML pages that are loaded into a MapGuide Viewer or browser frame. This is the form that will be used for most examples in this guide. It is possible, however, to create MSPs that do not return HTML or interact with the Viewer at all. These can be used for creating web services as a back-end to another mapping client or for batch processing of your data.
Creating an MSP requires initial setup, to make the proper connections between the Viewer, the page, and the MapGuide site. Much of this can be done using Studio. Refer to the Studio Help for details.
One part of the initial setup is creating a web layout, which defines the appearance and available functions for the Viewer. When you define a web layout, you assign it a resource name that describes its location in the repository. The full resource name looks something like this:
Library://Samples/Sheboygan/Layouts/SheboyganPhp.WebLayout
When you open the web layout using a browser with either the AJAX Viewer or the DWF Viewer, the resource name is passed as part of the Viewer URL. Special characters in the resource name are URL-encoded, so the full URL would look something like this, (with line breaks removed):
http://localhost/mapguide/mapviewerajax/
?WEBLAYOUT=Library%3a%2f%2fSamples%2fSheboygan%2fLayouts%2f
SheboyganPhp.WebLayout
Part of the web layout defines commands and the toolbars and menus that contain the commands. These commands can be built-in commands, or they can be URLs to custom MSPs. The custom MSPs are what make up your application.
To create a new MSP and make it available to a Viewer, add a command to the web layout. Set the command type to Invoke URL. Set the URL of the command to the URL of your page, and add the command to the Task Bar Menu.
It is possible to add custom commands to other menus as well. For most of the examples in this guide, however, the commands will be part of the Task Bar Menu. Output from an MSP normally appears in the task pane, though you may direct it to another frame or new window if desired.