Re: [SMARTY] register modifier in classes
| From: | Wom.bat | Date: | Sun, 27 Jul 2003 16:37:28 +0000 |
| Subject: | Re: [SMARTY] register modifier in classes | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9967@lists.php.net to get a copy of this message | ||
On Sunday, July 27, 2003 5:06 PM +0200, Florian Winkler wrote:
> Hello Smarty-friends ;-) ,
>
> I want to register a modifier in a class , which looks like this :
>
> class forum
> {
> function format_text($text)
> {
> //do something with $text;
> return $text;
> }
> function output_text()
> {
> //register modifier
> $call_tpl = "used_tpl.html";
> $tpl->display($call_tpl);
> }
> }
>
> does anybody know how I can register this function as a modifier ?
you can only register methods of objects (i.e. instances of classes)...
$smarty->register_modifier("format_text", array(&$object,
"format_text"));
> Furthermore I would like to know the difference between section and
> foreach I seems to me as if it is the same.
> When should I use section , when foreach ?
> which one is faster ?
hmm... dunno... I just hate sections... I always use foreach :)
David