[development] low hanging fruit for Drupal 6: variable defaults

Dries Buytaert dries.buytaert at gmail.com
Thu May 3 21:01:57 UTC 2007


On 03 May 2007, at 14:39, Earnie Boyd wrote:
> <?php
> define('MY_DEFAULT_VALUE', t('my_default_value'));
> ?>

How about this:

define('site_name', 'example');

function variable_get($name) {
   $value = db_result(db_query(...));
   return $value ? $value : constant($name);
}

print variable_get('site_name');

Might get us the best of both worlds? :)

--
Dries Buytaert  ::  http://www.buytaert.net/



More information about the development mailing list