[Typo3-dev] Integrating RTE in BE module
Markus Lange
markus.lange at bgm-gmbh.de
Tue Dec 14 11:51:27 CET 2004
Hi Suman,
Suman Debnath sagte:
> I want the form to have a RTE (rtehtmlarea) instead of the normal
> Text Area field. Therefore, I am
> integrating the form in mod1/index.php. Any pointers on how to do it?
i once made it but unfortunately ONLY with standard rte (ie only)
################
#include classes
....
require_once( PATH_t3lib . 'class.t3lib_tceforms.php' );
require_once(PATH_t3lib.'class.t3lib_parsehtml_proc.php');
....
$tceforms = t3lib_div::makeInstance("t3lib_TCEforms");
$form = $tceforms->JStop();
$elname = 'data'; //prefix
$fname = 'data_files'; //prefix
$table = 'tt_content'; //dummy
$row = array(); //dummy
$row['uid']= 1; //dummy
$field = $elname.'[' . $cfg['uid'] . '][values][' . $languid .
'][0]';//name of field
$extra =
'richtext[paste|bold|italic|underline|formatblock|class|left|center|right|orderedlist|unorderedlist|outdent|indent|link|image|user]:rte_transform[flag=rte_enabled|mode=css]';
$PA = array();
$PA['altName'] = "Text";
$PA['palette'] = 0;
$PA['extra'] = $extra;
$PA['pal'] = 9;
$PA['itemFormElName']=$elname.'[' . $cfg['uid'] . '][values][' . $languid
. '][0]'; //formfieldname /name of post var
$PA['itemFormElValue']= 'hey i am text'; // The value to show in the form
field.
$form.= $tceforms->getSingleField_typeText($table,$field,$row,&$PA);
$form.= '<script type="text/javascript">
var TBE_RTE_WINDOWS = new Array();
function TBE_EDITOR_setRTEref(RTEobj,theField,loadContent) { //
TBE_RTE_WINDOWS[theField] = RTEobj;
if (loadContent) { RTEobj.setHTMLdocument.editform[theField].value);
}
}
</script>';
$form.=$tceforms->JSbottom();
returm $form;
....
IMPORTANT:
the (overall-)form MUST have name=editform
$PA array:
itemFormElName name of formfield
extras MUST be set otherwise only plain text field
itemFormElValue preset a value
all other values fill with dummy text
just debug post vars for submitted data
its a quick hack but apparently working
take a look at t3lib_tceforms and rte_api for htmlarea
hth
--
Markus Lange
business group munich GmbH
Tel. + 49 89 / 660 7 999 - 36
Fax + 49 89 / 660 7 999 - 10
Mobil + 49 173 / 57 06 453
www.bgm-gmbh.de
http://typo3.bgm-gmbh.de
More information about the TYPO3-dev
mailing list