setPageNameIndex (BX_PAGE_DEFAULT); $oTemplate->setPageHeader ("Visual editor"); $oTemplate->setPageContent ('page_main_code', PageCompMainCode()); $oTemplate->getPageCode(); /** * page code function */ function PageCompMainCode() { ob_start(); if (bx_get('my_textarea')) echo 'Submitted data:
' . bx_process_output(bx_get('my_textarea')) . '
'; echo '
'; // form must have id echo ''; // print text area element echo ''; echo '
'; bx_import('BxDolEditor'); // import editor class $oEditor = BxDolEditor::getObjectInstance(); // get default editor object instance if ($oEditor) // check if editor is available for using echo $oEditor->attachEditor ('#my_textarea'); // output HTML which will automatically apply editor to textarea element by its id // print all available editors and editors view modes below echo '
'; $aEditors = array('sys_cleditor', 'sys_tinymce'); $aViewModes = array(BX_EDITOR_MINI => 'Mini', BX_EDITOR_STANDARD => 'Standard', BX_EDITOR_FULL => 'Full'); foreach ($aViewModes as $iViewMode => $sViewModeHeader) { echo "

$sViewModeHeader

"; foreach ($aEditors as $sEditor) { $sId = 'textarea_' . $sEditor . '_' . $iViewMode; echo ''; $oEditor = BxDolEditor::getObjectInstance($sEditor); if (!$oEditor) continue; echo $oEditor->attachEditor ('#' . $sId, $iViewMode); echo '
'; } } return DesignBoxContent("Visual editor", ob_get_clean(), BX_DB_PADDING_DEF); } /** @} */