JEditor: Using $this when not in object context

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
pvh123
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Wed Oct 05, 2005 7:25 am
Location: Amsterdam
Contact:

JEditor: Using $this when not in object context

Post by pvh123 » Sat Oct 06, 2007 8:28 pm

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();
?>
               


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  :( :(
Last edited by pvh123 on Tue Oct 09, 2007 3:45 pm, edited 1 time in total.
;) pieter

User avatar
pvh123
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Wed Oct 05, 2005 7:25 am
Location: Amsterdam
Contact:

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

Post by pvh123 » Tue Oct 09, 2007 8:00 am

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
Last edited by pvh123 on Tue Oct 09, 2007 3:45 pm, edited 1 time in total.
;) pieter


Post Reply