UDT not working after upgrade to cmsms

General project discussion. NOT for help questions.
Post Reply
olumide
Forum Members
Forum Members
Posts: 108
Joined: Mon Mar 21, 2011 10:26 am

UDT not working after upgrade to cmsms

Post by olumide »

Please can someone point me in the right direction why my udt stopped working after i upgraded to cmsms 1.10.3.
Here is my code below:

Code: Select all

if (!function_exists('MyGetModuleInstance'))
{
        function &MyGetModuleInstance($module)
        {
                $gCms = cmsms();
                if (isset($gCms->modules[$module]) &&
                        $gCms->modules[$module]['installed'] == true &&
                        $gCms->modules[$module]['active'] == true)
                {
                        return $gCms->modules[$module]['object'];
                }
                // Fix only variable references should be returned by reference
                $tmp = FALSE;
                return $tmp;
        }
}
global $gCms; 
$db =& $gCms->GetDb();

$ob = MyGetModuleInstance('Olu_Banner');
if ($ob == FALSE)
  return false;
  
  $query4 = "SELECT * FROM " . cms_db_prefix() . "module_Olu_Banner_banneradvert WHERE bannerimage != '' AND active = '1' ";

     $dbresult4 = $db->Execute( $query4);
     if(!$dbresult4) {
       echo "DB Error: " . $db->ErrorMsg();
     } elseif ($dbresult4->RecordCount() > 0) {

 echo "<div id=\"banner_scroll\">";
   
while ($dbresult4 && $row4 = $dbresult4->FetchRow()) {
echo "<a href=\"http://$row4[website]\" target=\"_blank\" \><img src=\"$row4[bannerimage]\" style=\"border:0px\"/></a>";


   }
echo "</div>";  
}
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: UDT not working after upgrade to cmsms

Post by Rolf »

Try changing

Code: Select all

global $gCms;
into

Code: Select all

$gCms = cmsms();
Try to remove the Module Instance lines for a while. Less lines to debug ;)

grtz. Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
olumide
Forum Members
Forum Members
Posts: 108
Joined: Mon Mar 21, 2011 10:26 am

Re: UDT not working after upgrade to cmsms

Post by olumide »

Thanks for that without the module instance and changing global $gCms; to $gCms = cmsms(); it works but immediately i added the module instance and this line

Code: Select all

$ob = MyGetModuleInstance('Olu_Banner');
if ($ob == FALSE)
  return false;
it stopped working so please how do i add this back to it without it breaking
Post Reply

Return to “General Discussion”