Drupal API

drupal操作数据库的api

日期:2014-09-22 阅读:2246

dmandwp系统 - wordpress系统和DM系统区块建站>>

  db_query:

 $node_limit = variable_get('recent_posts_block_count', 3);
      $content_type = 'blog';
      $query = db_query('SELECT n.nid FROM {node} n WHERE n.type = :type AND n.status = 1 ORDER BY n.created DESC LIMIT 0, ' . $node_limit, array(':type' => $content_type));
      $nids = $query->fetchCol();    //这是取得多个node的id
      $nodes = node_load_multiple($nids); //把上面取的id生成对象

-----------------------

<<点击返回

Drupal7视频教程 Drupal7主题 Drupal7最新文档 Drupal7推荐文档
  • 暂无内容!
  • 暂无内容!