Information Technology

Using with an Application

Once aMapApp3 is setup you need to modify the web application to use it.  Please note that we haven't tested all possible places we could add the required lines, but the locations given here work.

Once you have a basic web page for the application, you need to tell the page where things are located.  This is ugly, but mostly boilerplate.  In this example, we are assuming that the various pieces are all located directly under the top of the web server’s data structure, as well as the folder containing this page.  At the top of your file, before the <DOCTYPE> tag, add the following,

<?php
require_once "/path_to_config_file/your_config_file.php";
require_once XAJAX_PATH."/xajax_core/xajax.inc.php";
$xajax = new xajax();
require_once UTILITY_LIBRARY;
require_once DB_DATABASE_LIBRARY;          
dl_dbInit();             
include(MAPAPP_PATH."/mapApp_xajaxFunctions.php");   
?>

You will have to determine the path to the configuration file but everything else can be entered as given.

Please note that the order here is important.

Next, right after the <html> tag add

<?php
  $xajax->printJavascript(XAJAX_URL);               
?>

 Notice that in the line above we have XAJAX_URL and not XAJAX_PATH. Next, after the <title> tag add,

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<?php
include MAPAPP_PATH."/mapAppObject.php";
?>

This points to a file that contains the start of aMapApp3 code.

 Now, adjust the <body> tag,

<body onLoad="load();">

“load()” is the function that we use to create the MapApp object.  The function could be included in this file or included in another file.  There are alternative ways of having this code run when the page is loaded, but this is simple. Of course, depending on the needs of the application, additional code will be needed.

We now have everything in place.  The next step is to create the aMapApp3 object inside of the load function.  At it's most basic we would have,

function load() {
    myMapApp = new aMapAppObject(configObject = new Object());
}

enclosed in script tags.

This uses all the default values provided by the system, including centering the map on Amherst, MA. Obviously, you would rarely want to do that.  The heart of the aMapApp3 is the ability to adjust the look and performance of the object by altering the configuration object.  That configuration object contains a set of general properties, plus three configuration objects that are then passed to other objects to control properties of the locations, the login system, the blogs (if any) and the image viewer.

The final step is to create the web page.  This needs to include <div> tags with the ID's set to either the default values aMapApp3 is expecting or values that are passed to it in the configuration object.  See the section on General Configuration Properties for the <div> tags you'll need and default ID's.

Configuration Object Settings

The aMapApp configuration object contains a number of general properties.  In addition, it contains some additional configuration objects that it passes along to subordinate objects.

An example showing a minimal setup is available.  An example is available showing what this all looks like in a more complicated situation.