Re: [SMARTY] function in template
| From: | Max Schwanekamp | Date: | Tue, 13 Dec 2005 23:51:33 +0000 |
| Subject: | Re: [SMARTY] function in template | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-13190@lists.php.net to get a copy of this message | ||
domantas wrote:
my source in php : $this->tpl->register_object('loginForm', $usersModule); my source in tpl : i need to call function "view" with param ('login') in template. Something like this : <th width="20%" colspan="4" scope="row">{loginForm->view('login')}</th>In your PHP $usersModule->view should take parameters like this: function view($params, &$smarty) { $what=$params['what']; switch ($what) {
//etc} return $someValue; } Your template code would then be like this: {loginForm->view what="login"}{* outputs login form HTML *} HTH -- Max Schwanekamp http://www.neptunewebworks.com/