![]() |
Passing Smarty variable to PHP
When the registration form is submitted (or anywhere on or before the final checkout page) the page needs to execute a php script that will pass the currently set Smarty variables $search.engine and $search.phrase to php variables $search.engine and $search.phrase. Once those two variables are set in PHP, I've got the rest.
Two Questions, How do I execute a PHP script from within Smarty? How do I pass a variable from Smarty to PHP? Any help on this would be appreciated! |
Code:
{* smarty *} As for getting Smarty object variables you can easily see they are accessible with following template code: Code:
{php}func_print_r($this->_tpl_vars);{/php} ..And if your not doing the php inside of a .tpl, simply use $Smarty instead of $this. |
Thank you for your previous answer, I have one more question..
I have found the values I need in PHP.. how do I reference them? Ive come up with: Code:
[_userinfo] => Array I need to be able to call extra.. How do I go about this in PHP? Ive tried $_userinfo[extra] but that doesnt seem to do anything.. |
Try:
Code:
$Smarty->_tpl_vars['_userinfo']['extra'] |
That sure makes a lot more sense, but unfortunately it doesn't do anything still.. My code is
Code:
{php} |
Nevermind, I changed $Smarty to $this (im in {php}).. Thanks a ton!
|
All times are GMT -8. The time now is 11:00 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.