|
|
ServerClipboardThe Server Clipboard is a BXE [Plugin], which allows to put elements on a server and later get it again. For example if you want to copy a node from one document to another. Config.xmlYou have to put the following into your config.xml, to include the plugin: <plugins> The option urlfunction defines, which user defined function has to be called to get the URL, where the element should be stored. This makes it very flexible and you can customize it to your needs (if you want for example include a user-id into the request). User defined functionIf you want to use userdefined functions in BXE, the best thing is to put them into a seperate JavaScript file and include that also via the config.xml file <scripts> The path is resolved relative to the bxeLoader.js file (except, when it starts with http:// or /, then it's absolute). BXE now calls your defined function for getting the URL, it provides one parameter, which can either be POST or GET. One for storing the element and one for getting it. A very simple function looks like this. function bxe_serverClipboardURL(action) { Unknown macro: { return "clipboard.php?action=POST"; }
else Unknown macro: { return "clipboard.php?action=GET"; }
} Server sideThe server has to store the send elememt somehow (it's a serialized XML document) and later send it back. A very simple implementation in PHP: <?php Unknown macro: { $_POST['content'] = stripslashes($_POST['content']); }
file_put_contents("clipboard.xml",$_POST['content']); Unknown macro: { header("Content-type}
?> Make sure, you send the content-type as text/xml and be aware, that the input is always utf-8 encoded. CaveatsIt doesn't work, if you load BXE from the filesystem (via file://) in the browser |