*SOLVED*Pass php variable to UDT

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Akonkagva
Forum Members
Forum Members
Posts: 11
Joined: Mon Aug 31, 2009 8:09 pm

*SOLVED*Pass php variable to UDT

Post by Akonkagva »

UDT PART: echo ' Hello ' . $params['name'] . '!';
TEMPLATE PART: {helloworld name='Bob'}
work's fine
But when I need to pass php variable like:
UDT PART: echo 'Hello ' . $params['name'] . '!';
TEMPLATE PART:
TEMPLATE PART: {helloworld name='$bob'}
It doesn't work as it should.
How to pass php varialbe to UDT ?

Thank you for your answers and Happy NEW YEAR !
Last edited by Akonkagva on Thu Dec 31, 2009 7:10 pm, edited 1 time in total.
fredp
Forum Members
Forum Members
Posts: 218
Joined: Sun Jul 27, 2008 1:36 am
Location: USA

Re: Pass php variable to UDT

Post by fredp »

Akonkagva wrote: ...
UDT PART: echo 'Hello ' . $params['name'] . '!';
TEMPLATE PART:
TEMPLATE PART: {helloworld name='$bob'}
It doesn't work as it should.
How to pass php varialbe to UDT ?

Thank you for your answers and Happy NEW YEAR !
Hi,

I think you might want to improve/refresh your PHP and Smarty knowledge a bit. ;) 

Remember that PHP handles single-quoted strings and double-quoted strings differently.  A review of the PHP docs might prove helpful in understanding the difference.  You might start here:
  http://www.php.net/manual/en/language.types.string.php

Similarly, a review of the Smarty docs may help you understand the differences between PHP variables and Smarty "template variables".  You might start with these pages:
  http://www.smarty.net/manual/en/language.variables.php
  http://www.smarty.net/manual/en/languag ... iables.php

Hope this helps,
Fred P.
Nearly all men can stand adversity, but if you want to test a man's character, give him power.
- Abraham Lincoln
spngg
New Member
New Member
Posts: 7
Joined: Sat Dec 12, 2009 6:21 pm

Re: *SOLVED*Pass php variable to UDT

Post by spngg »

I'm also looking for a solution to this very problem, i've read the documentation in the links, but don't see a relation, does anyone have an example of how to pass in variables to a UDT?

thanks in advance
Post Reply

Return to “Modules/Add-Ons”