zoukankan      html  css  js  c++  java
  • drupal7 常用的数据读取API (转)

    // node
    node_load($nid = NULL, $vid = NULL, $reset = FALSE);
    node_load_multiple(
    $nids = array(), $conditions = array(), $reset = FALSE);

    // user
    user_load($uid, $reset = FALSE);
    user_load_multiple(
    $uids = array(), $conditions = array(), $reset = FALSE);

    // menu tree
    menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL);
    menu_tree_page_data(
    $menu_name, $max_depth = NULL, $only_active_trail = FALSE);

    // term
    taxonomy_term_load($tid: object
    taxonomy_term_load_multiple($tids = array(), $conditions = array()) : array
    taxonomy_get_tree($vid, $parent = 0, $max_depth = NULL, $load_entities = FALSE: array

    // block
    block_load($module, $delta);

    // Pager
    db_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();

  • 相关阅读:
    【硬件】PCB设计步骤
    【modbus】modbus协议入门讲解
    【I2C】上拉电阻的选择
    【运放】失调电压、偏置电流
    【硬件】模拟地和数字地的隔离
    【电力】电流互感器和电压互感器
    【电力】为什么高电压传输时线路损耗小
    【办公】pdf转ppt的方法
    【EMC】电压暂降、短时中断和电压变化
    js 下的 split
  • 原文地址:https://www.cnblogs.com/ginikeer/p/3536173.html
Copyright © 2011-2022 走看看