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';
}
[solved,tks!]confused when reading the module.inc.php file
[solved,tks!]confused when reading the module.inc.php file
Last edited by huyimin on Thu Oct 23, 2008 4:26 am, edited 1 time in total.
Re: confused when reading the module.inc.php file
whar version of cmsms are you using?
--
Alan Ryan
Lead Developer
CodeCrunchers Internet Software Development - Ireland
http://www.codecrunchers.ie
Alan Ryan
Lead Developer
CodeCrunchers Internet Software Development - Ireland
http://www.codecrunchers.ie
Re: confused when reading the module.inc.php file
I am using cmsms 1.4.1, does this matters?aln_cms wrote: whar version of cmsms are you using?
$CMS_VERSION = "1.4.1";
$CMS_VERSION_NAME = "Spring Garden";
$CMS_SCHEMA_VERSION = "31";
Re: confused when reading the module.inc.php file
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.
Re: confused when reading the module.inc.php file
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
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