0

I'm trying to display to users an editor in the front end of my website (in a logged in area)

I have:

// 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");

$stuff = 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'
);

// DISPLAY THE EDITOR (name, html, width, height, columns, rows, bottom buttons, id, asset, author, params)
echo $editor->display('editMain', '', '75%', '400', '20', '20', 'true', null, null, null, $params);

But no matter what I do the buttons won't show on load. Instead you need to click Toggle editor to get them to show. None of the other editors work so can't tell if it's just tinymce.

thanks

2 Answers 2

0

In a fresh Joomla install, the above code works as expected - the editor is shown as expected.

One thing to note, The "buttons" parameter is expected to be boolean, so you don't need the quotes around your "true".

When you say the "buttons won't show on load", what do you actually mean? Does the TinyMCE editor load, but without buttons? Or is it the textarea with raw HTML shown that you would see if you toggle the editor off?

In the TinyMCE plugin settings, you can control the buttons that are shown per group level - can you confirm that the user you are logging is as is correctly assigned to the right group, and that group has a toolbar set defined?

0

Change the 'true' to true. Eg drop quotes

echo $editor->display('editMain', '', '75%', '400', '20', '20', **true**, null, null, null, $params);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.