Page 1 of 1

get value from tpl?

Posted: Thu Dec 31, 2009 12:52 am
by soclose
Hi All,

I want to get a value that is count number of selected items of multi-select combo. I got this value from tpl file. But I don't know how to get back this value to php file! I'd like to describe it in text box. how to code?

Re: get value from tpl?

Posted: Thu Dec 31, 2009 1:27 am
by soclose
how about {capture}? if so, how to code?

Re: get value from tpl?

Posted: Thu Dec 31, 2009 1:32 am
by alex.barylski
That sounds really hackish, usually you perform all calculations inside the Model (View maybe) then assign values to the template for immediate rendering...why are you trying to send a count value back to PHP, I think it's technically impossible as the template usually renders after business logic, etc so at the very most you would be able to log the counter value.

Use a global or increment a value passed in, and echo the value in side PHP after the template.

Secondly, ask in Smarty forums, seeing as this is a Smarty issue you will stand better luck getting an answer there.

Cheers,
Alex

Re: get value from tpl?

Posted: Sun Jan 03, 2010 11:13 pm
by soclose
Thanks PCSpectra. Now I get it! See more : http://www.smarty.net/forums/viewtopic. ... 1849#61849