eval in smarty/codeigniter
I am trying to use one of CodeIgniter functions with smarty which the variable name is Dynamic.
normally the function is called like this :
{set_value(aaa, $f_aaa} <br>
开发者_如何学C
but in my code aaa is replaced with a dynamic value
first part is easy :
{set_value($row->Field, $f_aaa} <br>
but I don't know how to use eval in smarty for this situation .
it should call the function with a loop (ex with following input/variable)
{set_value(name, $f_name}
{set_value(address, $f_address}
edit: I forgot to say PHP's native eval
function is not working inside smarty .. it's showing following error :
unknown function "eval"'
eval
is not a function - it is language construct and it cannot be called the way smarty is calling normal functions.
If you want to use CI helper inside Smarty, take a look at this Smarty plugin
https://github.com/fadillzzz/Smarty-CI-Helper/
It'll give you the ability to call any CI helper functions from the Smarty templates using the Smarty syntax
have you used {php} tag.
精彩评论