Page 1 of 1

[SOLVED] UDT params

Posted: Mon Jun 01, 2009 10:04 am
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');

Re: [SOLVED] UDT params

Posted: Mon Jun 01, 2009 12:46 pm
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