All pastes #90640 Raw Edit

Unnamed

public text v1 · immutable
#90640 ·published 2006-07-17 21:51 UTC
rendered paste body
//ok this is real messy. 
//


function text1_set($text1, $default) {
  global $conf;

  db_lock_table('text1');
  db_query("DELETE FROM {text1} WHERE text1 = '%s'", $text1);
  db_query("INSERT INTO {text1} (text1,($text1, $default)) VALUES ('%s', '%s')", $text1, serialize($text1, $default));
  db_unlock_tables();

  cache_clear_all('variables');

  $conf[$text1] = $text1;
} 


//i dont really know if this is correct or not
//




function text1_get($text1, $default) {
  global $conf;

  return isset($conf[$first_www]) ? $conf[$first_www] : $default;
} 


///here is the part in the form
//

function alexa_page() {

  $form['text1'] = array(
    '#type' => 'textfield',
    '#default_value' =>  text1_get('text1', 'www.digg.com'),
  );