lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
PHP: Singleton Pattern for Composed Objects
I usually use a variation of the method below in classes that include a composed object (e.g., a database object):

// method: load composed object
function _load_object()
{
// already loaded
if ( is_object($this->ComposedObject) ) return;

require_once($this->PATH['composed_object_class']);

// create composite object
$this->ComposedObject = new ComposedObject();
// add additional config steps here

return;
}
// END method


For an example, see the _load_phpmailer method in my CeoFramework class.

Labels:

Firefox Crashing?
Running Firefox 2.0.0.7. All of the sudden it's been crashing like mad the last couple days. (I'm running it on Windows XP.)

Haven't been able to identify a common thread. I have a page with Google AdWords on it and it crashed it repeatedly.

Saw something somewhere (sorry, didn't bookmark) that suggested disabling Firebug. My AdWords page opened.