Drupal api

지각생 연습장
(files)
(category)
13번째 줄: 13번째 줄:
 
= category =
 
= category =
 
카테고리/taxonomy(hierarchy)/tag 등
 
카테고리/taxonomy(hierarchy)/tag 등
 +
== taxonomy_save_vocabulary ==
 +
아래 부분만 활용하면 될듯
 +
<pre>
 +
  $edit['vid'] = db_next_id('{vocabulary}_vid');
 +
    db_query("INSERT INTO {vocabulary} (vid, name, description, help, multiple, required, hierarchy, relations, tags, weight, module) VALUES (%d, '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, '%s')", $edit['vid'], $edit['name'], $edit['description'], $edit['help'], $edit['multiple'], $edit['required'], $edit['hierarchy'], $edit['relations'], $edit['tags'], $edit['weight'], isset($edit['module']) ? $edit['module'] : 'taxonomy');
 +
    foreach ($edit['nodes'] as $type => $selected) {
 +
      db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $edit['vid'], $type);
 +
    }
 +
    module_invoke_all('taxonomy', 'insert', 'vocabulary', $edit);
 +
    $status = SAVED_NEW;
 +
</pre>
  
 
= comment =
 
= comment =

2007년 3월 26일 (월) 00:32 판

개인 도구