Very simple question, is it possible to use a smarty var inside the {php}{/php} tags. I know it’s deprecated, pointless, not recommended, etc., but please, I am looking for a simple patch !
Something like
{php} $result = mysql_query("SELECT value FROM table WHERE fieldid = 9 AND relid = {MYSMARTYVAR}"); {/php}
Thank you!
Update: I`ve tried the following methods.
1-$var = $this->get_template_vars('smarty_var'); 2-$var = $smarty->getTemplateVars('smarty_var'); 3-$var = $this->_tpl_vars['smarty_var'];
All give me Fatal errors, $this when not in object context etc. I`m in the WHMCS environment, if this explains why perhaps certain things are blocked or disabled?
Update 2; found a solution more simple than it seemed, I feel silly: $var= “{$mysmartyvar}”;
Thanks everyone!
Advertisement
Answer
Use $this->get_template_vars('smarty_var')
to get a Smarty variable.
$result = mysql_query("SELECT value FROM table WHERE fieldid = '9' AND relid = '" . $this->get_template_vars('smarty_var') . "'");