Přeskočit přímo na text


Problém s uložením premenej do DB

Kategorie: Databázové problémy
Týká se verze: Drupal 7.x

Podľa http://api.drupal.org/…cabularies/7 som si vytvoril nasledovnú funkciu:

<?php
function catalog_settings($form, &$form_state) {

$vocabulary = taxonomy_get_vocabularies();
$selectlist_vocab_array =  array('0' => '--none--');
foreach ($vocabulary as $item) {
  $key = $item->vid;
  $value = $item->name;
  $selectlist_vocab_array[$key] = $value;
  }

  $form['district'] = array(
    '#type'             => 'select',
    '#title'            => t('Services'),
    '#position'         => 'left' ,
    '#options'          => $selectlist_vocab_array ,
    '#default_value'    => variable_get('catalog_settings_service',''),
    '#description'      => t('Vocabulary use as a Service'),
  );
  $form['services'] = array(
    '#type'             => 'select',
    '#title'            => t('District'),
    '#position'         => 'left' ,
    '#options'          => $selectlist_vocab_array ,
    '#default_value'    => variable_get('catalog_settings_district',''),
    '#description'      => t('Vocabulary use as a Service'),
  );
     return system_settings_form($form);
}
?>

Po odoslaní Drupal zobrazí hlášku, že nastavenie bolo uložené ale v skutočnosti sa nič nestane.

Kde môže byť problém?

Ďakujem.

 

Nejako sa mi to zle

Nejako sa mi to zle sformátovalo, neviem čo s tým je :(

je potrba pouzit /-

je potrba pouzit

/- --code

bez te mezery, viz http://www.drupal.cz/filter/tips

S D7 zatial nerobim ale

S D7 zatial nerobim ale pokial viem tak potrebujes aby sa premenne volali rovnako aj vo formulari, cize:

<?php
function catalog_settings($form, &$form_state) {
  $vocabulary = taxonomy_get_vocabularies();
  $selectlist_vocab_array =  array('0' => '--none--');
  foreach ($vocabulary as $item) {
    $key = $item->vid;
    $value = $item->name;
    $selectlist_vocab_array[$key] = $value;
  }

  $form['catalog_settings_service'] = array(
    '#type'             => 'select',
    '#title'            => t('Services'),
    '#position'         => 'left' ,
    '#options'          => $selectlist_vocab_array ,
    '#default_value'    => variable_get('catalog_settings_service',''),
    '#description'      => t('Vocabulary use as a Service'),
  );
  $form['catalog_settings_district'] = array(
    '#type'             => 'select',
    '#title'            => t('District'),
    '#position'         => 'left' ,
    '#options'          => $selectlist_vocab_array ,
    '#default_value'    => variable_get('catalog_settings_district',''),
    '#description'      => t('Vocabulary use as a Service'),
  );

  return system_settings_form($form);
}
?>

Nakoniec bola chyba

Nakoniec bola chyba v premenných už to funguje. Ďakujem.

Poslat nový komentář

Obsah tohoto pole je soukromý a nebude veřejně zobrazen.
  • You can use Texy! to format and alter entered content.
  • Povolené HTML značky: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <p> <br> <b> <i> <h2> <img> <pre> <sup> <sub> <pre class="php"> <span class="php-keyword1"> <span class="php-var"> <span class="php-num"> <img class="screenshot"> <p class="beginner"> <a class="greybox"> <h3> <h4>

Více informací o možnostech formátování

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.

Hledat

Přihlášení

Bezpečnost Drupalu

Z hlediska bezpečnosti je Drupal na velmi vysoké úrovni, díky propracovanému systému hlášení, prověřování a řešení možných problémů.

Čtěte více a odebírejte bezpečnostní aktuality

Poslední komentáře

Kdo je online

Momentálně je online 1 uživatel a 0 hostů.

Online uživatelé