[drupal-devel] Getting rid of global variables
neil at civicspacelabs.org
neil at civicspacelabs.org
Fri Sep 30 19:25:37 UTC 2005
On Fri, Sep 30, 2005 at 08:43:10PM +0200, Adrian Rossouw wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 30 Sep 2005, at 7:34 PM, neil at civicspacelabs.org wrote:
> >How about drupal_(set|get)_global(). And drupal_(set|get)_object() can
> >be used to get statically cached objects (nodes, terms, users,
> >vocabularies, etc) from the db.
> Dude. I love that =)
>
> but maybe call it drupal_(set|get)_static() ..
> pseudo code for all those functions with static's in them would be
>
> if (!($obj = drupal_get_static('obj', null)) {
> $obj = db_result(db_query('select blah'));
This will probably be some sort of callback system. $module and $type
would be arguments for the generic static caching function and then call
$module_get_$type().
> drupal_set_static('obj', $obj);
> }
-Neil
More information about the drupal-devel
mailing list