0

In Smarty: is it possible to call a PHP function (from the controller class) inside the template? there is explained, how to call class methods out of template files.

You nee to assign the object like

$smarty->assign('a', new Controller);

and you can use it like

{$a->foo(5)}

But what, if I want to pass a smarty array value as parameter? It should be something like this:

{foreach from=$dataset item=data}
   {$a->foo($data.id)}
{/foreach}

for sure, this won't work. But how can this issue be handled?

1 Answer 1

0

Chapter 15. Advanced Features

This is what you need?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.