我需要写php代码来改变我的视图的字段值。我有一个php模板文件,在主题下,代码如下:
$view = views_get_view_result("gallery");
$count = count($view);
if ($count>=1) {
$ids = explode(",", $view[0]->nextag_items_tags);
$tagword = "";
foreach ($ids as $id) {
$query = db_select('nextag_words', 'a');
$query->fields('a', array('tagword'));
$query->condition('a.id', $id, '=');
$results = $query->execute()->fetchField();
$tagword .= $results . ",";
}
$view[0]->nextag_words_tagword = $tagword;
//?????? My question is here
}
我的问题是我如何设置drupal视图的新字段值,这样显示就会改变?这件事已经困扰我很久了……
感谢大家的宝贵时间!
是否只需要更改视图字段显示?使用预处理函数或视图钩子,如hook_views_pre_render()。