RE: [SMARTY] call to class/method -- function included
| From: | mark priatel | Date: | Sun, 15 Dec 2002 03:29:36 +0000 |
| Subject: | RE: [SMARTY] call to class/method -- function included | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6807@lists.php.net to get a copy of this message | ||
I've had this function kicking around in my plugins dir for awhile.
Hope it helps! I haven't done much QA on it, but it seems to work in
all of my applications.
Works something like this:
<?php
class FooBar{
function foo ( $msg = '...', $msg2 = '...' ){
echo " foobar->foo : $msg , $msg2 ";
}
}
$smarty->assign("anObject" , new FooBar() );
?>
--- template --
{ call obj=$anObject method='foo' arg1='this is arg1' arg2='this is
arg2' }
----------------
-mark
> -----Original Message-----
> From: akorthaus@web.de [mailto:akorthaus@web.de]
> Sent: Saturday, December 14, 2002 8:53 AM
> To: smarty-general@lists.php.net
> Subject: [SMARTY] call to class/method
>
> Hi!
>
> Is it possible to get data into a smarty-template by calling al
> class-method direktly? I would like to place a "CALL" inside the
> template, which directly gets its data form a function inside a class,
> or is it only possible to write the result of the funktion into a
> variable and use this value?
>
> regards
> Andreas
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php