Re: [SMARTY] Re: call to class/method

From: Date: Sun, 15 Dec 2002 01:15:29 +0000
Subject: Re: [SMARTY] Re: call to class/method
References: 1 2 3 4  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6803@lists.php.net to get a copy of this message
Hi!
Ah, you might try this. Call the insert function and then inside the insert function you either reference a preexisting class or create a new one and work with it. I don't think it's possible to call a class directly from a template, but using insert you can call a function that loads the class, works with the class and then returns the results. I hope that helps!
But this function has to be in my module php-Script, and there I only want to have the class. Perhaps I can rewrite the {INSERT}-Plugin of smarty, so I build in an own {INSERT2}, which is a copy of {INSERT}, only modified this way, that the Inside-Funktion translates the tmplate-Variable in another way: {insert name="getBanner"} will do: insert_getBanner(); {insert2 name="getBanner"} will do: $my_class -> insert_getBanner(); Or isn´t it that simpe as I think now? Regards Andreas

« previous php.smarty.general (#6803) next »