Re: [SMARTY] function in template

Max Schwanekamp <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
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/

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.