call a module via udt

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
pistols
New Member
New Member
Posts: 8
Joined: Tue Jun 17, 2008 8:26 am

call a module via udt

Post by pistols »

Hello There, I would like to encapsulate some logic into udt. so I can keep a simple template.

I have a condition. If the condition is true I want to show an image
If not i want to show a module (showtime)

So i have this

$gCms = cmsms();
$contentops = $gCms->GetContentOperations();
$content_obj = $contentops->getContentObject();
if (!is_object($content_obj)) {return;}

if (file_exists($content_obj->Alias().".jpg")) {
$smarty->assign('picture', '<img src="tick.jpg" alt="" />');
} else {
//Here I need help
//Call module Showtime with parameter 1 in smarty
//{Showtime show='1'}
}

So bottom line is, I don't know how to call a module within an udt

Thanks
Nikolas
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: call a module via udt

Post by Rolf »

Just wondering why you use a UDT for this and don't use Smarty in your page or template...
Something like:

Code: Select all

{if $foo == $bar}
<img src="" />
{else}
{Showtime}
{/if}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
pistols
New Member
New Member
Posts: 8
Joined: Tue Jun 17, 2008 8:26 am

Re: call a module via udt

Post by pistols »

Hello Rolf,

Well the main reason is because the logic behind finding that image file is a little bit more complicated. Currently i have a solution similar to the one you are suggesting, but i would like to call only my udt in the template.

Nikolas
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: call a module via udt

Post by calguy1000 »

something like this:

Code: Select all

$module = cms_utils::get_module('ShowTime');
if( is_object($module) ) {
   $out = $module->DoAction('cntnt01','default',$parameters,$current_page_id);
}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “CMSMS Core”