2

I've inherited some custom code running in Joomla 3.0.2 - we it's actually some standalone php/javascript that's run using Sourcerer (ie not a proper component).

I need it to display an rich-text editor, so I'm trying to use the standard editors which come with joomla. I've written some PHP based on this tutorial:

    $document =& JFactory::getDocument();
    $document->addScript('includes/js/joomla.javascript.js');

    $editor =& JFactory::getEditor();
    echo $editor->display('content', 'some content', '550', '400', '60', '20', false);

However all I get is a standard textarea without the toolbars. I've tried setting all pre-installed editors (CodeMirror, TinyMCE) to the default editor, plus I've tried the JCE and JoomlaCK plugins - all with the same result.

I guess the problem is that the code example is for an older version of Joomla, as includes/js/joomla.javascript.js doesn't exist. But I can't find an updated example anywhere... please help!

adamf321
  • 179
  • 1
  • 9

1 Answers1

0

Try using the following:

$document = JFactory::getDocument();
$document->addScript(JURI::root() . 'includes/js/joomla.javascript.js');

$editor = JFactory::getEditor();
echo $editor->display('content', 'some content', '550', '400', '60', '20', false);
Lodder
  • 19,758
  • 10
  • 59
  • 100
  • Thanks, but this doesn't work either. The file literally isn't there in Joomla 3 - I assume it's either been moved since 2.5 or that it no longer exists and there's a new way of doing this. – adamf321 Dec 24 '12 at 14:48