Having php code:
function getChildren($parent_id = 0)
{
....
return $SomeChildrenArray;
}
And Smarty assignation $smarty->assign('children', getChildren($id));
How to write smarty expression to pass some value to the function?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Smarty can be extended through its plugins API. See registerPlugin() for an introduction.
and
would output
Note that plugin functions have to return a string.
Since Smarty3 you can call and assign arbitrary functions from within a template:
This way you can call any function and return any value/type you want. See Smarty_Security for details on how to control which functions may be called…