Page 1 of 1

CMSMailer example wouldnt work

Posted: Fri Jun 22, 2012 11:26 am
by cb2004
In the help section of the module that example would not work:

$cmsmailer = $this->GetModuleInstance('CMSMailer');

should be:

$cmsmailer = cms_utils::get_module('CMSMailer');

Re: CMSMailer example wouldnt work

Posted: Fri Jun 22, 2012 12:29 pm
by calguy1000
incorrect.

Both syntaxes are valid.

Re: CMSMailer example wouldnt work

Posted: Fri Jun 22, 2012 12:43 pm
by airelibre
But
$cmsmailer = $this->GetModuleInstance('CMSMailer');

is not deprecated?

Re: CMSMailer example wouldnt work

Posted: Fri Jun 22, 2012 12:56 pm
by calguy1000
No it's not deprecated.

Re: CMSMailer example wouldnt work

Posted: Fri Jun 22, 2012 1:05 pm
by cb2004
Set up a UDT with the example code, ran it, didn't work. Changed the UDT to use cms_utils::get_module('CMSMailer'), ran it, it worked.

Re: CMSMailer example wouldnt work

Posted: Fri Jun 22, 2012 1:09 pm
by calguy1000
Of course the example won't work from a UDT. $this->GetModuleInstance() is a module API method.

Issue closed.