[drupal-devel] Getting rid of global variables

Adrian Rossouw adrian at bryght.com
Fri Sep 30 18:43:23 UTC 2005


-----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'));
    drupal_set_static('obj', $obj);
}


- --
Adrian Rossouw
Drupal developer and Bryght Guy
http://drupal.org | http://bryght.com


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFDPYc+gegMqdGlkasRAl3aAJ9pWy0JD49ZSrCqAHbvo4Sw8tzYMwCgzQBC
Zti81e5peWZBrJeoU0pwXdQ=
=4jt9
-----END PGP SIGNATURE-----



More information about the drupal-devel mailing list