drupal7 常用的数据读取API

来源:互联网 发布:淘宝店铺转让平台 编辑:程序博客网 时间:2024/06/06 03:35
// nodenode_load($nid = NULL, $vid = NULL, $reset = FALSE);node_load_multiple($nids = array(), $conditions = array(), $reset = FALSE);// useruser_load($uid, $reset = FALSE);user_load_multiple($uids = array(), $conditions = array(), $reset = FALSE);// menu treemenu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL);menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = FALSE);// termtaxonomy_term_load($tid) : objecttaxonomy_term_load_multiple($tids = array(), $conditions = array()) : arraytaxonomy_get_tree($vid, $parent = 0, $max_depth = NULL, $load_entities = FALSE) : array// blockblock_load($module, $delta);// Pagerdb_select('node', 'n')    ->extend('PagerDefault')->limit(5)    ->fields('n');->fetchField();db_query_range('SELECT n.nid, n.title, n.created  FROM {node} n WHERE n.uid = :uid', 0, 10, array(':uid' => $uid));$fields = array('nid' => 1, 'title' => 'my title', 'body' => 'my body');db_insert('node')->fields($fields)->execute();db_update('example')  ->condition('id', $id)  ->fields(array('field2' => 10))  ->execute();// select$query = db_select('comment', 'c')  ->fields('c', array('subject', 'name'))  ->fields('n', array('title'))  ->extend('PagerDefault')->limit(5)  ->condition('n.type', array('article'), 'IN')  ->orderBy('c.cid', 'DESC');$query->join('node', 'n', 'n.nid = c.nid');$data = $query->execute();


原创粉丝点击