I'm trying to upgrade my websites to CMS v.2 and I'm running into problems with $smarty in UDT.
Basically, I know how to get / set data in $smarty and in $gCms in v.1 but I fail to map my knowledge to v.2. I've read the Introduction to Writing Modules for CMS Made Simple as well as the new doc on writing UDT but couldn't find answers here.
I understand that there's a new concept of "local" rather than "global" $smarty vars but I'm unsure how to handle that.
Basically, I'm trying to define smarty variables in a UDT, then read it in another UDT.
Code: Select all
// WRITE DATA in UDT #1
global $smarty;
$smarty->assign('weblang', $mydata);
// READ DATA in UDT #2
global $smarty;
......... $smarty->get_template_vars('weblang') ......
I understand that I should remove global $smarty; but how to make this work? How to make things global? Maybe I should use this new " $smarty->fetch(...)" but I don't know how to find documentation on it. Could someone please help?
Now for something different, am I doing this correctly?
Code: Select all
// for v.1
$gCms = cmsms();
// for v.2
$gCms = CmsApp::get_instance();
Code: Select all
$c_ =$currentContent->GetPropertyValue('_content_' . $smarty->get_template_vars('weblang'));