Page 1 of 1

Re: references and the $gCms

Posted: Mon Dec 04, 2006 2:23 pm
by Ted
Great!  I'm glad it's working for you enough to make that big of a leap.

References are used throughout CMSMS because of some versions of php4 not handling object references correctly.  I took every opportunity to use references to keep memory usage down.  A lot these extra reference calls will disappear in 1.1 since php5 treats objects as references by default.

The global $gCms makes it so that $gCms acts as a singleton of sorts, though in 1.1 I'm changing this to work as a true singleton (with a global function, cmsms() to retrieve it, instead).  So, yeah, it's just one object defined in include.php and reused over and over again (again, to keep memory usage down by having one reference of many of the global-type objects).

Also, it's a good idea to look at the Skeleton module.  It's got a very nice setup of explaining what everything in the module api is doing...  though it might be a bit out of date now, but I'm not sure.

And, of course, jump on IRC if you have any developer type questions.  I'm usually around during the day to answer stuff like that.