function node_load

node_load($nid = NULL, $vid = NULL, $reset = FALSE)

Loads a node object from the database.

Parameters

$nid: The node ID.

$vid: The revision ID.

$reset: Whether to reset the node_load_multiple cache.

Return value

A fully-populated node object, or FALSE if the node is not found.

File

modules/node/node.module, line 963
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_load($nid = NULL, $vid = NULL, $reset = FALSE) {
  $nids = (isset($nid) ? array($nid) : array());
  $conditions = (isset($vid) ? array('vid' => $vid) : array());
  $node = node_load_multiple($nids, $conditions, $reset);
  return $node ? reset($node) : FALSE;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!node!node.module/function/node_load/7.x