How would I go about writing a plugin to add a bit of html to the bottom of the add/edit content page?
Hi Mark,
These are the events for the manager document/content page:
OnDocFormPrerender
OnDocFormRender
OnBeforeDocFormSave
OnDocFormSave
OnBeforeDocFormDelete
OnDocFormDelete
To diplay some text inside the page use:
OnDocFormRender
Here’s an example:
$e = & $modx->Event;
switch ($e->name) {
case "OnDocFormRender":
$html = "
<div class='sectionHeader'><img src='media/images/misc/dot.gif' alt='.' /> My Box</div>
<div class='sectionBody'>
<input type='checkbox' name='someoption' value='1' />
Some text here
</div>
";
$e->output($html);
}
Ok, now how would I do the following?
Say that if that checkbox is checked, initiate an action contained within a module AFTER THE PAGE IS SAVED.
Quote from: Mark at Nov 06, 2005, 11:24 PM
Ok, now how would I do the following?
Say that if that checkbox is checked, initiate an action contained within a module AFTER THE PAGE IS SAVED.
Well (currentlly) you can’t invoke a module from within the API. But you can include and external php file with the code to be executed. For example you could store parts of the module as an include file.
Ok, simple enough.So now the question reads:
Say that if that checkbox is checked, initiate an action contained within a php file AFTER THE PAGE IS SAVED.
Give this a try:
case "OnDocFormSave":
include_once "assets/modules/mymod/file.php";
if($_POST['someoption']=='1') {
// do something
}
break;
you might want to try and fo this:
$replace_richtexteditor = array("ta");
if(is_array($replace_richtexteditor)) {
// invoke OnRichTextEditorInit event
$evtOut = $modx->invokeEvent("OnRichTextEditorInit",
array(
editor => $modx->config['which_editor'],
elements => $replace_richtexteditor
));
if(is_array($evtOut)) echo implode("",$evtOut);
}
Change to:
$evtOut = $modx->invokeEvent("OnRichTextEditorInit",
array(
'editor' => $modx->config['which_editor'],
'elements' => $replace_richtexteditor
));