Content to UDT elegantly, page or GCB?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
asdf
Forum Members
Forum Members
Posts: 39
Joined: Thu Jul 08, 2010 1:11 pm

Content to UDT elegantly, page or GCB?

Post by asdf »

I need to merge HTML-content that is editable in the CMSMS admin system into output that is produced by UDT. Each content is quite short, 2-3 paragraphs, each 5-10 rows. The content will not be shown elsewhere and which one is chosen depends on what the UDT does.

I could get page in following http://forum.cmsmadesimple.org/viewtopi ... 07#p237407 as well as global content block following http://forum.cmsmadesimple.org/viewtopi ... 52#p228652 .

Maybe it's just me :) but somehow I don't like either. A page feels too much, it's not a page but just part of it. On the other hand the trick to do GCB is not pretty to me, calling some 'random' module to get content does not sound too 'pure'.

UDT should be able to test if content X exists, so if it not, it could do something instead saying: "Smarty error: unable to read resource: globalcontent..." as can happen with GCB method.

Please advise me with this problem? Or is there third, an elegant and clean option? I wouldn't mind to use an extra module, providing it was widely used and updates would be available if needed after core changes.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Content to UDT elegantly, page or GCB?

Post by jmcgin51 »

asdf wrote: On the other hand the trick to do GCB is not pretty to me, calling some 'random' module to get content does not sound too 'pure'.
? I don't follow...
asdf wrote: UDT should be able to test if content X exists, so if it not, it could do something instead saying: "Smarty error: unable to read resource: globalcontent..." as can happen with GCB method.
I have a GCB that is usually empty, and I just test for its contents when the page loads. If empty, the GCB is ignored. If there is some content, then it is displayed. No error is shown if empty.

I'm still not 100% sure I understand what you're needing.
asdf
Forum Members
Forum Members
Posts: 39
Joined: Thu Jul 08, 2010 1:11 pm

Re: Content to UDT elegantly, page or GCB?

Post by asdf »

I meant with 'pure' this part:

Code: Select all

$gCms->modules[$modules[0]]['object'];
On my system $modules[0] happens to be CMSMailer. It's just that I find it not that nice to go this way, it works same way with $modules[1] too. Why to call 'random' module when all you need is to access GCB. Sorry that I cannot express myself, hope you get the idea. I do admit I do not know CMSMS internals so this may be very well the only way to access data. If that's the only way I can live with it.

Thanks, maybe I just missed how GCB can be tested. Will have a look, must be doable.
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: Content to UDT elegantly, page or GCB?

Post by Jos »

In stead of this

Code: Select all

$gCms->modules[$modules[0]]['object'];
You can use this

Code: Select all

$gCms->modules['CMSMailer']['object'];
asdf
Forum Members
Forum Members
Posts: 39
Joined: Thu Jul 08, 2010 1:11 pm

Re: Content to UDT elegantly, page or GCB?

Post by asdf »

Thanks for the tip, but that is exactly what I consider non-elegant. Why to use mailer or whatever module to access global data instead of using more general way, that was my point. But it seems there's no such way, so I just must live with the fact.
Post Reply

Return to “CMSMS Core”