Page 1 of 1

Trying to access contents of global content block inside UDT

Posted: Thu Apr 04, 2019 7:57 pm
by bailiwick
I have a global content block (basically contains a select element with options which I'd like to be able to change from one location but need to appear throughout my site in various forms) and I'd like to be able to include its content inside one of my forms which is currently created within a UDT.

I searched forums and found something that looked promising but which (after trying to use on my site*) causes my page template to break:

Code: Select all

$gCms = cmsms();
$modules = array_keys($gCms->modules);
$modObj = $gCms->modules[$modules[0]]['object'];
//following line kills page
$selItems = $modObj->ProcessTemplateFromData(‘{global_content name=\’mygcbname\’}’);
*CMSMS Version 1.11.13

Would appreciate any guidance!

Re: Trying to access contents of global content block inside

Posted: Thu Apr 04, 2019 10:44 pm
by DIGI3
Personally, I would upgrade to 2.x, use CGBetterForms for the form, and LISE to populate the dropdown. The way you're doing it sounds messy.

Re: Trying to access contents of global content block inside

Posted: Fri Apr 05, 2019 9:35 am
by Rolf