Re: Class methods for custom functions

From: Date: Wed, 05 Dec 2001 16:39:50 +0000
Subject: Re: Class methods for custom functions
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2146@lists.php.net to get a copy of this message
On Wed, 05 Dec 2001, Ivo Jansch wrote: > Sorry, we had sinterklaasviering here, which involved some beer. :) > > No, I mean this: You said the instance of the object would only be > available at compiletime and not at runtime. Why? If I do this in my > index.php: > > $myobj = new myobj(); > $smarty = new smarty(); > $smarty->register_function("sometag", "myobj->mymember"); > ... > > then why would $myobj not be available at runtime? It's always created. > You just have to get it from the globals. > That's what I meant with the author being responsible for creating an > instance of the object. Because the accepted syntax in PHP for specifying a method as a closure is array($obj, 'method'). And then, what if your $myobj is not in globals but inside a function? -Andrei * "I'll need daily status reports on why you're so behind." -- Dilbert's boss *

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