Allen Shaw wrote:
David Krings wrote:
...I will need three editor
components on the page and now wonder on how to add a second editor object. ...

Currently, I got this:
     $oFCKeditor = new FCKeditor('sbtext');
...
When I now want to initiate a new editor, do I change it like this:
     $oFCKeditor = new FCKeditor('sbnotes') ;
or like this
     $oFCKeditorNotes = new FCKeditor('sbnotes');

So, unrelated to the editor, how do I instantiate a second instance of an object?


Your second choice is the one you want. The code "new FCKeditor('whatever')" returns a distinct FCKeditor object, which you should store in a distinct variable. If you just use the same variable as for the first object, $oFCKeditor, you'll overwrite the value of that variable and lose the object.

OO concepts can be daunting at times, but in this case it's a simple matter of storing someting in a variable. If you wrote:

    $fruit = 'apple';  // I need some fruit
    $fruit = 'pear';   // I need another kind of fruit

then you'd expect the 'apple' value to be overwritten and gone. Same with the objects.

Hope this helps.

- Allen

It definitely does! Thank you very much! :)


_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to