Accessing an object within another object in Drupal -


i have array output drupal, how access value of [name] field_episode_tags, have far

print $node->field_episode_tags['und']['0']['taxonomy_term']->['name'] 

when 'taxonomy term' there object tried using -> poitner did not work.

stdclass object     (         [vid] => 25         [uid] => 1         [title] => there cosmos theory?         [log] =>          [status] => 1         [comment] => 1         [promote] => 0         [sticky] => 0         [nid] => 25         [type] => tv_episode         [language] => en         [created] => 1380610491         [changed] => 1381115053         [tnid] => 0         [translate] => 0         [revision_timestamp] => 1381115053         [revision_uid] => 1         [body] => array             (                 [und] => array                     (                         [0] => array                             (                                 [value] => summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text                                  [summary] =>                                  [format] => filtered_html                                 [safe_value] => <p>summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text</p>                                  [safe_summary] =>                              )                      )              )          [field_video_category] => array             (                 [und] => array                     (                         [0] => array                             (                                 [tid] => 25                             )                      )              )          [field_featured] => array             (             )          [field_kaltura_video] => array             (             ) und 0 taxonomy term->name          [field_episode_tags] => array             (                 [und] => array                     (                         [0] => array                             (                                 [tid] => 95                                 [taxonomy_term] => stdclass object                                     (                                         [tid] => 95                                         [vid] => 1                                         [name] => zen                                         [description] =>                                          [format] =>                                          [weight] => 0                                         [vocabulary_machine_name] => tags                          [rdf_mapping] => array 

you need access instance datamember directly without brackets []. these used array keys.

 print $node->field_episode_tags[language_none]['0']['taxonomy_term']->name 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -