如何在 joomla 3 组件中设置高级 tinymce
How to set advanced tinymce in joomla 3 component
我调用编辑器,它出现了,但它是扩展版本,为整个页面的管理员全局设置,我希望它保持这种状态。
但是在我的组件中我想要一个高级版本的 tinymce。
这是我如何调用 tinymce 的代码:
$editor = JFactory::getEditor();
$editor =& JFactory::getEditor('tinymce');
$params = array(
'mode' => 'advanced'
);
echo $editor->display('opis_long', $this->info['opis_long'], '10', '10', '1', '1', false, $params);
// IMPORT EDITOR CLASS
jimport( 'joomla.html.editor' );
// GET EDITOR SELECTED IN GLOBAL SETTINGS
$config = JFactory::getConfig();
$global_editor = $config->get( 'editor' );
// GET USER'S DEFAULT EDITOR
$user_editor = JFactory::getUser()->getParam("editor");
if($user_editor && $user_editor !== 'JEditor') {
$selected_editor = $user_editor;
} else {
$selected_editor = $global_editor;
}
// INSTANTIATE THE EDITOR
$editor = JEditor::getInstance($selected_editor);
// SET EDITOR PARAMS
$params = array( 'smilies'=> '0' ,
'style' => '1' ,
'layer' => '0' ,
'table' => '0' ,
'clear_entities'=>'0',
'mode' => '1'
);
// DISPLAY THE EDITOR (name, html, width, height, columns, rows, bottom buttons, id, asset, author, params)
echo $editor->display('opis_long', $this->info['opis_long'], '400', '400', '20', '20', true, null, null, null, $params);
核心代码来自:How to add joomla editor in custom component view but without using XML form fields?
我调用编辑器,它出现了,但它是扩展版本,为整个页面的管理员全局设置,我希望它保持这种状态。
但是在我的组件中我想要一个高级版本的 tinymce。
这是我如何调用 tinymce 的代码:
$editor = JFactory::getEditor();
$editor =& JFactory::getEditor('tinymce');
$params = array(
'mode' => 'advanced'
);
echo $editor->display('opis_long', $this->info['opis_long'], '10', '10', '1', '1', false, $params);
// IMPORT EDITOR CLASS
jimport( 'joomla.html.editor' );
// GET EDITOR SELECTED IN GLOBAL SETTINGS
$config = JFactory::getConfig();
$global_editor = $config->get( 'editor' );
// GET USER'S DEFAULT EDITOR
$user_editor = JFactory::getUser()->getParam("editor");
if($user_editor && $user_editor !== 'JEditor') {
$selected_editor = $user_editor;
} else {
$selected_editor = $global_editor;
}
// INSTANTIATE THE EDITOR
$editor = JEditor::getInstance($selected_editor);
// SET EDITOR PARAMS
$params = array( 'smilies'=> '0' ,
'style' => '1' ,
'layer' => '0' ,
'table' => '0' ,
'clear_entities'=>'0',
'mode' => '1'
);
// DISPLAY THE EDITOR (name, html, width, height, columns, rows, bottom buttons, id, asset, author, params)
echo $editor->display('opis_long', $this->info['opis_long'], '400', '400', '20', '20', true, null, null, null, $params);
核心代码来自:How to add joomla editor in custom component view but without using XML form fields?