Jump to content

how to output it?


runeveryday

Recommended Posts

the print_r($a)'s result is

 


views_handle_field_node Object

(

[view]=>view Object

(
[db_table] => views_view
[base_table] => node
[args] => Array
(
[0] => My entry 1
)

[use_ajax] =>
[result] => Array
(
[0] => stdClass Object
(
[nid] => 5
[node_title] => Title of a test entry
[node_revisions_body] =>
[node_revisions_format] => 1
[node_vid] => 5
[term_data_name] => My first test term name
[term_data_vid] => 1
[term_data_tid] => 1
[vocabulary_name] => Vocabulary 1
[node_revisions_vid] => 5
)

[1]=> stdClass Object
(
[nid] => 8
[node_title] => Title of a test entry
[node_revisions_body] =>
[node_revisions_format] => 1
[node_vid] => 5
[term_data_name] => My first test term name
[term_data_vid] => 1
[term_data_tid] => 1
[vocabulary_name] => Vocabulary 1
[node_revisions_vid] => 5
..
[2]..
..



 

now i want to output the [nid]=>5 and[nid]=>8.....and all the nid's value.i use this, but can't work.

 

$views_handle_field_node->$view->$result[]->nid. what's the correct output of it.

Link to comment
https://forums.phpfreaks.com/topic/220717-how-to-output-it/
Share on other sites

I would assume this code to work:

 

 

foreach($a->result as $node)
{
$node->nid;
}

 

 

Using your expression (and assuming you're doing drupal), I believe the code you're looking for is similar to:

 

$views_handle_field_node->view->result[$i]->nid

 

Hope this helps. :)

Link to comment
https://forums.phpfreaks.com/topic/220717-how-to-output-it/#findComment-1143159
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.