Discussion: function in template
Afficher un message
Vieux 14/12/2005, 00h51   #2
Max Schwanekamp
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] function in template

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/
  Réponse avec citation
 
Page generated in 0,04481 seconds with 9 queries