Page 1 of 1

JEditor: Using $this when not in object context

Posted: Sat Oct 06, 2007 8:28 pm
by pvh123
I am replacing the function
in a 1.0 script with this
It runs in the admin end and is supposed to provide an edit session.
Running the script gives me this error:
"Fatal error:  Using $this when not in object context in H:\wwwroot\libraries\joomla\html\editor.php on line 191

"
The script looks like this and I did the import of the editor:
jimport( 'joomla.html.editor' );
$editor =& JFactory::getEditor();
?>
               
                function submitbutton(pressbutton) {
                        var form = document.adminForm;
                        if (pressbutton == 'cancelcatg') {
                                submitform( pressbutton );
                                return;
                        }

                        // do field validation
                        try {
                        document.adminForm.onsubmit();
                        }
                        catch(e){}
                        if (form.name.value == ""){
                                alert( "Category must have a title" );
                        } else {
                               
                                submitform( pressbutton );
                        }
                }
               
I understand that the error is fired because of the use of "$this" in the editor.php script, but I do not know how to solve this.
So I am really looking for suggestions  :( :(

Re: JEditor: Using $this when not in object context

Posted: Tue Oct 09, 2007 8:00 am
by pvh123
I did have a look at the base component "admin.content.html.php" and realised that I already had setup the editor instance with this
$editor =& JFactory::getEditor();
and therefore have to use this
getContent( 'editor1', 'description' ) ; ?>
  ;)

Any agreement? Anyway I help report if it solved my problem.

Edit: Yes, it did solve my problem  :D :D :D :D