Tech-Tidbit: Smarty Variables
One of my recent projects was using Smarty - I found myself in a position where I needed to access a variable assigned to a Smarty template directly - I could not access it before/while it was being assigned and Smarty doesn’t provide enough resources to interact with it directly before it’s actually transferred to the template. Smarty does allow you to edit other variables by using the global command in php, but not those that have already been assigned.
What did I end up doing? I just accessed the Smarty template object itself.
[php]$this->_tpl_vars['name_of_template_var_here'];[/php]
I had to perform some fairly fancy tests on that data. Then, if you want modify that data you can just save it back to the above variable or re-assign it:
[php]$this->Assign(”name_of_template_var_here”, $new_value_here);[/php]