你好!
我正在努力获取视图的范围
有一个守则:
$variables = module_invoke('views', 'block_view', 'news-block');
print render($variables['content']);显示单元软件。
是否有可能得到这样的结论。而是从变量$variables跨字段获取视图。
提前感恩
对不起我的英语。
发布于 2015-10-15 12:01:00
您可以使用views_get_view_result函数:
$view = views_get_view_result($name, $display_id); // returns an array conatining the result of the view
print_r($view);如果您希望获得整个节点对象,则可以在每一行的nids中使用node_load函数:
$view = views_get_view_result($name, $display_id); // returns an array conatining the result of the view
$nodes = array(); // create an empty array to push each node objects
foreach ($view as $row) {
$node = node_load($row->nid); // get the node object by nid
$nodes[] = $node; // push node to $nodes array
}
print_r($nodes);https://stackoverflow.com/questions/33084072
复制相似问题