Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created July 14, 2011 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterdavis/1083103 to your computer and use it in GitHub Desktop.
Save walterdavis/1083103 to your computer and use it in GitHub Desktop.
<page-action name = "PHP Config Page">
<action-version version="0.1">
“Config Page” Action
(c) Walter Davis Studio 2011
Removes everything from the current page, and replaces it with the contents of the edit box.
</action-version>
<action-checkbox name="Activate" default=yes>
<action-text var name="config" />
<action-button name="Config Directives" onclick=EditCode('config'); />
<action-javascript>
function EditCode(param){
// Borrowed from Source Code Snooper, by Tim Plumb
var mycustomcode = fwParameters[param].toString();
var myprompt = "Enter your directies. Do not include the PHP delimiters.";
var mycustomcodeprompt = fwBigPrompt(myprompt, mycustomcode);
if (mycustomcodeprompt != null) { //if the cancel button was not hit
if (mycustomcodeprompt != mycustomcode) {//check that the code has changed
fwParameters[param].fwValue = mycustomcodeprompt;
}
}
}
function fwAfterEndHTML(){
if(fwParameters.Activate.fwBoolValue){
var html = fwDocument.fwTags.fwFindAll();
for (i in html) html[i].fwDelete();
fwDocument.fwWrite("<?php\n" + fwParameters.config.toString() + "\n?>");
}
}
</action-javascript>
</page-action>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment