-
- 3,250 Posts
How would I go about writing a plugin to add a bit of html to the bottom of the add/edit content page?
-
- 1,732 Posts
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);
}
-
- 3,250 Posts
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.
-
- 1,732 Posts
Quote from: Mark at Nov 07, 2005, 05:24 AM
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.
-
- 3,250 Posts
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.
-
- 1,732 Posts
Give this a try:
case "OnDocFormSave":
include_once "assets/modules/mymod/file.php";
if($_POST['someoption']=='1') {
// do something
}
break;
-
- 1,732 Posts
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);
}
-
- 1,732 Posts
Change to:
$evtOut = $modx->invokeEvent("OnRichTextEditorInit",
array(
'editor' => $modx->config['which_editor'],
'elements' => $replace_richtexteditor
));