EditLive! 9 Documentation : Basic PHP Code
Created by Jessica Hardy, last modified on Mar 01, 2011
<?php
//load the XML file into the string "$xmlConfig"
// this helps to speed up the ELJ load time
$filename = "config.xml";
$fd = fopen($filename,"r");
$xmlConfig = fread ($fd, filesize($filename));
fclose ($fd);
$pageContent = "<p>Document contents of EditLive!</p>"
?>
<html>
<head>
<title>Sample EditLive! PHP Integration</title>
<script src="../../redistributables/editlivejava/editlivejava.js">
</script>
</head>
<body>
<script language="JavaScript">
var editliveInstance;
// Create a new EditLive! instance with the name
// "ELApplet1", a height of 600 pixels and a width of 700 pixels.
editliveInstance = new EditLiveJava("ELApplet1", 700, 600);
// This sets a relative path to the directory where
// the EditLive! redistributables can be
// found e.g. editlivejava.jar
editliveInstance.setDownloadDirectory(
"../../redistributables/editlivejava"
);
// This sets a relative or absolute path to the XML
// configuration file to use.
editliveInstance.setConfigurationText("<?=rawurlencode($xmlConfig)?>");
// This sets the initial content to be displayed within
// EditLive!
editliveInstance.setBody("<?=rawurlencode($pageContent)?>");
// .show is the final call and instructs the JavaScript
// library (editlivejava.js) to insert a new EditLive!
// at the this location.
editliveInstance.show();
</script>
</body>
</html>