"Minimize HTTP Connections" Sample / PHP
The "Minimize HTTP Connections" Sample shows how you can speed up loading of edit-on Pro by minimizing the number of HTTP connections required. The editor loads the uiconfig and config XML data directly from a JavaScript string variable instead of accessing URLs.
This sample uses PHP in order to read standard config.xml and uiconfig.xml files into PHP string variables. These variables' values are used within the applet's JavaScript configuration.

 <?php
 // read the config.xml and uiconfig.xml as string
 $config = str_replace("\r", "", str_replace("\n", "", file_get_contents("../common/config-samples.xml")));
 $uiconfig = str_replace("\r", "", str_replace("\n", "", file_get_contents("../common/uiconfig-samples.xml")));   
 ?> 
 
 <script type="text/javascript">
   eop = new editOnPro(989, 400, "eop_inst1", "myId", "eop");
   .....
   // The JavaScript configuration APIs setConfig and setUIConfig set the configuration files as stings
   eop.setConfig(unescape("<?php echo $config; ?>"));
   eop.setUIConfig(unescape("<?php echo $uiconfig; ?>"));
   .....
 </script>  
												               
Back to Samples Index