These do two different things. The first saves a preference variable in the db. The second save a variable for the page load only.bess wrote: in class Foo
Which is better?Code: Select all
class Foo extends CMSModule
orCode: Select all
$this->GetPreference("fooPref"); $this->SetPreference("fooPref", 'new value');
Code: Select all
cms_utils::get_app_data('fooPref'); cms_utils::set_app_data('fooPref','new value');
For variables used during page load/execution the best way is to add it to the module object:
Code: Select all
$this->fooPref = 'new value';
echo $this->fooPref
Best (IIRC works in 1.8 as well)Which is better?
or (i suppose :p)Code: Select all
$feu = &$gCms->modules["FrontEndUsers"]['object'];
and forCode: Select all
$feu = cms_utils::get_module('FrontEndUsers','1.10');
do we must done something ?Code: Select all
$db =& $gCms->GetDb();
$feu = cmsms()->GetModuleInstance('FrontEndUsers','1.10');
$db = cmsms()->GetDb();
$smarty = cmsms()->GetSmarty()