I've been working on a module for my website and I came across a few situations in which I found two different examples of accomplishing what I wanted (in the documentation and other mod code).
The first situation involves getting a reference to $db.
In one place, I found...
$db =& $gCms->GetDb();
Somewhere else I found...
$db = $this->cms->db;
The second one seems to be better to me. I was just curious if one method was outdated and/or deprecated.
The other situation involves referencing one module from inside another module.
In the documentation, I found...
Code: Select all
global $gCms;
if( !isset( $gCms->modules['TheModuleIWant'] ) || !isset( $gCms->modules['TheModuleIWant']['object'] ) )
{
return;
}
$themoduleiwant = $gCms->modules['TheModuleIWant']['object'];
Code: Select all
$module =& $this->GetModuleInstance('FrontEndUsers');
if( !$module ) return FALSE;
I'm just learning my way around CMSMS, so I want to make sure I learn the preferred methods the first go around...
Thanks a ton,
- Walkere