The following assumes that an Apache server or another server capable of running PHP 5 is running on the default port (80) on localhost. The mxGraph top-level directory is assumed to be located at http://localhost/mxgraph.
In this example, a graph is programmatically created and turned into a PNG image. Point your browser to http://localhost/mxgraph/php/examples/graph.php to run this example.
Creates a HTML graphical representation for a GraphView which is stored in an XML file. Point your browser to http://localhost/mxgraph/php/examples/reader.php to run this example.
In order to be able to save files, the server.php file demonstrates how to accept a post request from a client, and put the data from the client request into a file on the disk.
<mxEditor urlPost="php/examples/server.php" ... >
This enables the save function in the editor and will post the XML of the current diagram to the server.php on the server. The script will write the diagram to a local file called diagram.xml in the same directory as the script is located.
Note that you will have to add the save action in the user interface. To add the save action to the dropdown list of actions, change the items in the diagrameditor.html file as follows:
var items = ['redo', 'ungroup', 'cut', 'copy', 'paste', 'show', 'exportImage', 'save'];