Greetings,
I have a UDT that looks something like this:
------------------------------
$test = $_GET['test'];
if($test == "basic"){
echo "{cms_module module='Quizzard' quiz_id='5'}";
}
------------------------------
This UDT is supposed to get the "test" variable from the URL, and if the "test" variable equals "basic", then the UDT should call the Quizzard module, quiz #5. Instead, unfortunately, the UDT simply prints "{cms_module module='Quizzard' quiz_id='5'}" on the page, readable by the visitor.
How can I get the UDT to interpret the module tag correctly so that it calls the module instead of printing text? I've also tried this variant of the code above, but I just get an "invalid code" error.
-------------------------------
$test = $_GET['test'];
if($test == "basic"){
{cms_module module='Quizzard' quiz_id='5'};
}
------------------------------
I also tried:
-----------------------------
$test = $_GET['test'];
if($test == "basic"){
echo "{cms_module module='Quizzard' quiz_id='5'}";
}
----------------------------
which doesn't throw errors, but also doesn't do anything at all on the page where I call the UDT.
Would appreciate any help. I think there must be a simple solution, but I'm an absolute newbie to PHP/Smarty coding and I have no idea where to start.
how to include module call in UDT IF statement
-
calguy1000
- Support Guru

- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: how to include module call in UDT IF statement
You can probably use the smarty eval function, or the ProcessTemplateFromData function (available via search) to do that.
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.
Re: how to include module call in UDT IF statement
Thanks for the response, Calguy. I did see something about "ProcessTemplateFromData", but I have no idea what it is or how to implement it in this code. Not sure about the Smarty eval function, either.

