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
call a module via udt
- Rolf
- Dev Team Member
- Posts: 7825
- Joined: Wed Apr 23, 2008 7:53 am
- Location: The Netherlands
- Contact:
Re: call a module via udt
Just wondering why you use a UDT for this and don't use Smarty in your page or template...
Something like:
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
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: call a module via udt
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
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
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: call a module via udt
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.
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.