I'm upgrading a module I was developing with cmsms 1.9.4.3 but I have a problem with an ajax file that writes in the db.
I make the ajax call from a module's template (.tpl).
My old, working, code in the ajax.php file:
Code: Select all
<?php
require '../../include.php';
$db=&$GLOBALS["gCms"]->db;
global $gCms;
if (!isset($gCms)) exit;
if (isset($gCms->modules['MyModule'])) {
$mymodule =& $gCms->modules['MyModule']['object'];
echo "Module OK";
}
I've changed the code to obtain my module object reference, using the cms_utils::get_module() method:
Code: Select all
<?php
require '../../include.php';
$db=&$GLOBALS["gCms"]->db;
global $gCms;
if (!isset($gCms)) exit;
if (isset(cms_utils::get_module('MyModule')) {
$mymodule = cms_utils::get_module('MyModule');
echo "Module OK";
}
What am I doing wrong?
Thank you