references and the $gCms

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: references and the $gCms

Post 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.
Post Reply

Return to “CMSMS Core”