get value from tpl?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
soclose
Forum Newbie
Posts: 19
Joined: Tue Nov 10, 2009 12:43 am

get value from tpl?

Post 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?
soclose
Forum Newbie
Posts: 19
Joined: Tue Nov 10, 2009 12:43 am

Re: get value from tpl?

Post by soclose »

how about {capture}? if so, how to code?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: get value from tpl?

Post 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
soclose
Forum Newbie
Posts: 19
Joined: Tue Nov 10, 2009 12:43 am

Re: get value from tpl?

Post by soclose »

Thanks PCSpectra. Now I get it! See more : http://www.smarty.net/forums/viewtopic. ... 1849#61849
Post Reply