90 lines
3.3 KiB
HTML
90 lines
3.3 KiB
HTML
<html>
|
|
<head>
|
|
<title>mxGraph PHP</title>
|
|
<link rel="stylesheet" href="../docs/css/manual-styles.css">
|
|
<link rel="stylesheet" href="../docs/css/manual-colors.css">
|
|
</head>
|
|
<body>
|
|
<h1>mxGraph PHP</h1>
|
|
<h2>Installation</h2>
|
|
<p>
|
|
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
|
|
<a href="http://localhost/mxgraph">http://localhost/mxgraph</a>.
|
|
</p>
|
|
<h2>Examples</h2>
|
|
<h3>Graph</h3>
|
|
<p>
|
|
In this example, a graph is programmatically created and turned into a PNG
|
|
image. Point your browser to
|
|
<a href="http://localhost/mxgraph/php/examples/graph.php">http://localhost/mxgraph/php/examples/graph.php</a>
|
|
to run this example.
|
|
</p>
|
|
<h3>Reader</h3>
|
|
<p>
|
|
Creates a HTML graphical representation for a GraphView which is stored in
|
|
an XML file. Point your browser to
|
|
<a href="http://localhost/mxgraph/php/examples/reader.php">http://localhost/mxgraph/php/examples/reader.php</a>
|
|
to run this example.
|
|
</p>
|
|
<h3>Server</h3>
|
|
<p>
|
|
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.
|
|
</p>
|
|
<p>
|
|
Before accessing the HTML files, you must modify the config file of the
|
|
example you want to use. For example, when using the diagrameditor.html
|
|
file, you should modify javascript/examples/editors/config/diagrameditor.xml.
|
|
The only change to the config file is to add the urlPost attribute to the
|
|
mxEditor node as follows:
|
|
</p>
|
|
<pre>
|
|
<mxEditor urlPost="php/examples/server.php" ... >
|
|
</pre>
|
|
<p>
|
|
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.
|
|
</p>
|
|
<p>
|
|
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:
|
|
</p>
|
|
<pre>
|
|
var items = ['redo', 'ungroup', 'cut', 'copy', 'paste', 'show', 'exportImage', 'save'];
|
|
</pre>
|
|
<p>
|
|
To use the example, point your browser to
|
|
<a href="http://localhost/mxgraph/javascript/examples/editors/diagrameditor.html">http://localhost/mxgraph/javascript/examples/editors/diagrameditor.html</a>
|
|
</p>
|
|
<h3>Session</h3>
|
|
<p>
|
|
The session.php example demonstrates the sharing of diagrams across a
|
|
number of clients. The program itself does not have an object
|
|
representation of the graph in memory, it only serves as a dispatcher for
|
|
the XML data among the clients.
|
|
</p>
|
|
<p>
|
|
To use the example, the respective session URLs must be assigned in the
|
|
mxEditor either programmatically or by use of the same config file as
|
|
above. For diagram sharing, the following attributes must be assigned:
|
|
</p>
|
|
<pre>
|
|
<mxEditor urlInit="/mxgraph/php/examples/session.php?init"
|
|
urlPoll="/mxgraph/php/examples/session.php"
|
|
urlNotify="/mxgraph/php/examples/session.php">
|
|
</pre>
|
|
<p>
|
|
To use the example, point your browser to
|
|
<a href="http://localhost/mxgraph/javascript/examples/editors/diagrameditor.html">http://localhost/mxgraph/javascript/examples/editors/diagrameditor.html</a>
|
|
</p>
|
|
<hr size="1">
|
|
© 2006-2013 by JGraph Ltd.
|
|
</body>
|
|
</html>
|