drupal 7 - node_load showing incorrect data -


i new drupal 7.

i trying load data of particular node type , title being passed parameter:

$param = array( 'type' => 'media', 'title' => 'home logo bottom image', 'status' => 1, );  // getting node details $result = node_load($param); echo "<pre>"; print_r($result);  stdclass object (     [vid] => 1     [uid] => 1     [title] => career tip 1     [log] =>      [status] => 1     [comment] => 2     [promote] => 1     [sticky] => 0     [nid] => 1     [type] => career_tips     [language] => und     [created] => 1377871907     [changed] => 1377871907     [tnid] => 0     [translate] => 0     [revision_timestamp] => 1377871907     [revision_uid] => 1     [body] => array         (             [und] => array                 (                     [0] => array                         (                             [value] => if meet woman doing stem job sounds remotely interesting you, see if can stop office “informational interview.” @ meeting, ask every single question have, if seem obvious or silly.                             [summary] =>                              [format] => full_html                             [safe_value] =>  if meet woman doing stem job sounds remotely interesting you, see if can stop office “informational interview.” @ meeting, ask every single question have, if seem obvious or silly.                               [safe_summary] =>                          )                  )          ) 

the output of above code not correct showing other title. missing here?

also want fetch custom field value of same node. there single api return entire data?

the behaviour of node_load function has changed in drupal 7. first parameter passed node_load has node id.

use entityfieldquery node ids matching query , load node using node_load($nid);

$query = new entityfieldquery(); $title = 'enter title of node want search here'; $query->entitycondition('entity_type', 'node')   ->entitycondition('bundle', 'career_tips')   ->propertycondition('status', 1)   ->propertycondition('title', $title);  $result = $query->execute();  if (isset($result['node'])) {   $node_nids = array_keys($result['node']);   $items = entity_load('node', $node_nids); }  // $items should contain nodes. 

also once have node object can use entitymetadatawrapper extract values conviniently.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -