Drupal api 문서 내용 보기
지각생 연습장
이동:
둘러보기
,
찾기
{{topmenu}} [[CMS]] / [[Drupal]] / [[CMS_Migration]] = node = node 추가, 관리 관련 * node_save(&$node) : $node->title 등을 설정해 준 후, 이 함수를 실행. $node->nid 가 empty면, 새 node라 보고, 추가하게 된다. = forum = * forum_insert($node) : 포럼에 추가할 때는 이것만 해주면 되겠다. $node에 대해서도 딱히 해주는게 전혀 없다. * 기타 유용할 것 같은 : forum_get_forums, forum_get_topics, forum_taxonomy .. * forum을 만드는 것은, 그냥 term_data 를 하나 추가해 주는 것이다. (taxonomy_save_term) forum 테이블에는 각 노드와 term 의 아이디가 연결된다. * term_hierarchy 테이블에 tid, parent 쌍에 forum, forum_container 의 tid 를 넣어준다. * term_node 테이블에는 nid, tid 쌍에 node id, forum 의 tid 를 넣어준다. 이건, forum topic 으로 넣을때와, 그 토픽에 카테고리 지정할때 하면 되겠다. * forum container 도 하나의 포럼이다. 포럼으로 생성한다음 variable_get, _set 함수를 이용해 forum_containers 의 value에 그 아이디를 추가해주면 된다. = files = 첨부파일 처리. 얼핏 못 찾겠다. * 그냥 files, file_revisions 테이블에 바로 써도 될 듯. files는 nid, file_revisions는 vid 로 접근하면 된다 = category = 카테고리/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; //이 줄은 불필요할지도. cache_clear_all(); </pre> = comment = == comment_save($edit) == <pre> $edit['cid'] = db_next_id('{comments}_cid'); $edit['timestamp'] = time(); if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too $edit['name'] = $user->name; } $edit += array('mail' => '', 'homepage' => ''); db_query("INSERT INTO {comments} (cid, nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (%d, %d, %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s')", $edit['cid'], $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], $_SERVER['REMOTE_ADDR'], $edit['timestamp'], $status, $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage']); _comment_update_node_statistics($edit['nid']); // Tell the other modules a new comment has been submitted. comment_invoke_comment($edit, 'insert'); // Add an entry to the watchdog log. watchdog('content', t('Comment: added %subject.', array('%subject' => $edit['subject'])), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], array('fragment' => 'comment-'. $edit['cid']))); } </pre> [[category: 기술]] [[category: CMS]]
틀:Topmenu
(
내용 보기
)
Drupal api
(으)로 돌아갑니다.
보기
문서
토론
내용 보기
역사
개인 도구
로그인
둘러보기
기술
정책
문화
활동
개인
오늘 학습 일지
대문
사용자 모임
요즘 화제
최근 바뀜
Search
도구모음
여기를 가리키는 문서
가리키는 글의 바뀜
특수 문서 목록