drupal视图---如何输出
print_r($a) 的结果是
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]..
..
如何使用一个变量的名称来输出 [nid]=>5 和 [nid]=>8.....并且所有 nid.i 都使用这个,但是无法工作。
$views_handle_field_node->$view->$result[]->nid
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]..
..
how to use one variable's name to out put the [nid]=>5 and[nid]=>8.....and all the nid.i use this, but can't work.
$views_handle_field_node->$view->$result[]->nid
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
变量名称是
$a
而不是 `$views_handle_field_node' 所以尝试:如果这没有帮助,那么告诉我们上下文是什么?您是否将此代码放入模块挂钩或模板文件中?我这种情况需要什么类型的视图设置。告诉我们“样式”和“行样式”。
The variables name is
$a
not `$views_handle_field_node' so try:If that doesn't help then tell us what is the context? Are you putting this code inside a module hook or a template file? I that case what type of view settings. Tell us the "Style" and "Row style".