[SOLVED] UDT params

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
rlparker25
Forum Members
Forum Members
Posts: 57
Joined: Thu Jan 17, 2008 3:58 pm

[SOLVED] UDT params

Post by rlparker25 »

Hello,

I am having some problems getting the information I want passed through to my UDTs.

I need to be able to pass information which is generated in smarty tags in the template through to a UDT

for example

I am using the products manager module which is working fine. On the category page there is the grid of products and I want to add a UDT into the template which will display a different button depending on the products attributes.

To do this I need to pass the value of {entry->id} into my UDT {button1 id="?????"} is there a way to do this?

thanks

Rachael


/*edit*/

I found the solution whilst reading a totally unrelated forum post!!

add {assign var='product_id' value=$entry->id} into the template just before you call the UDT then in your UDT use

$smarty =& $gCms->getSmarty();
$text = $smarty->get_template_vars('product_id');
Last edited by rlparker25 on Mon Jun 01, 2009 10:30 am, edited 1 time in total.
alby

Re: [SOLVED] UDT params

Post by alby »

rlparker25 wrote: To do this I need to pass the value of {entry->id} into my UDT {button1 id="?????"} is there a way to do this?
Have you read UDT documentation?
Pass your variable in tag (ex: {button1 product_id="yyy"}) and use $params['xxx'] in UDT (ex: $params['product_id'])


Alby
Post Reply

Return to “Developers Discussion”