CoreBOSBB

Full Version: Different instantiation of a module
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I see that we have:

PHP Code:
        $modname 'SalesOrder';
        
$module Vtiger_Module::getInstance($modname); 

To get a module instance. But is that (and if so, how) different from

PHP Code:
$so_focus = new SalesOrder(); 
?
The difference is that getInstance() will include the class file for you. In other words,

$focus = new XX();

requires that you have previously done

require_once('modules/XX/XX.php');

while the getInstance will check if the file is not loaded yet and load it for you
Ah, good to know. But any way you instantiate, the same methods will be available?
yes, it is exactly the same, getInstance() ends creating a new XX()