【问题标题】:How to set advanced tinymce in joomla 3 component如何在 joomla 3 组件中设置高级 tinymce
【发布时间】:2015-09-17 20:49:52
【问题描述】:

我打电话给编辑器,它出现了,但它是扩展版本,它是为整个页面的管理员全局设置的,我希望它保持这种状态。

但在我的组件中,我想要一个 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);

【问题讨论】:

    标签: php joomla tinymce joomla3.0 joomla-component


    【解决方案1】:
    // 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?

    【讨论】:

      猜你喜欢
      • 2014-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      • 2011-10-19
      • 2014-01-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多