[solved,tks!]confused when reading the module.inc.php file

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
huyimin
Forum Members
Forum Members
Posts: 17
Joined: Sat May 17, 2008 11:38 pm

[solved,tks!]confused when reading the module.inc.php file

Post by huyimin »

hi, everyone i am very new to cmsms,can you help me to explain this following code i took from module.inc.php.

  global $gCms;

  $smarty =& $gCms->GetSmarty();
  $smarty->register_function($this->GetName(),
   array($this,'function_plugin'));

what confused me is GetSmarty() seems not defined in this module.inc.php file and
this file doesn't include/require othere files and the GetName() is defined later as:
function GetName()
{
return 'unset';
}
Last edited by huyimin on Thu Oct 23, 2008 4:26 am, edited 1 time in total.
User avatar
aln_cms
Forum Members
Forum Members
Posts: 88
Joined: Mon Jan 08, 2007 7:09 pm
Location: Ireland

Re: confused when reading the module.inc.php file

Post by aln_cms »

whar version of cmsms are you using?
--
Alan Ryan
Lead Developer
CodeCrunchers Internet Software Development - Ireland
http://www.codecrunchers.ie
huyimin
Forum Members
Forum Members
Posts: 17
Joined: Sat May 17, 2008 11:38 pm

Re: confused when reading the module.inc.php file

Post by huyimin »

aln_cms wrote: whar version of cmsms are you using?
I am using cmsms 1.4.1, does this matters?
$CMS_VERSION = "1.4.1";
$CMS_VERSION_NAME = "Spring Garden";
$CMS_SCHEMA_VERSION = "31";
User avatar
duclet
Forum Members
Forum Members
Posts: 187
Joined: Fri Jun 23, 2006 12:55 pm

Re: confused when reading the module.inc.php file

Post by duclet »

The fact that it is a include files means it is being included in other file. While it is technically bad practice to leave out includes needed by this file, in this particular case, it does improves performance since those requires and require_onces waste a lot of resources. Basically, this file is being included in a file that already loaded all the other necessary files. To answer your question about GetSmarty though, and this is just a thought since I haven't personally check, but I would assume it be declared in global.inc.php or something of that nature.
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: confused when reading the module.inc.php file

Post by Dee »

The GetSmarty() function is a method of the global gCms object (which is of class CmsObject, defined in class.global.inc.php).
module.inc.php defines the CMSModule class, all modules extend this class. Each module class should have it's own GetName() function that overrides the one in the CMSModule class (which returns 'unset').

Regards,
D
Post Reply

Return to “Modules/Add-Ons”