钩子视图预渲染Drupal 6.x
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了钩子视图预渲染Drupal 6.x相关的知识,希望对你有一定的参考价值。
/** * Implementation of hook_views_pre_render(). * Check to reduce the number returned items to 2 from 3 if an advert is present in the view attachment. */ function modulename_views_pre_render(&$view) { //bit nasty? global $alter_num_results; if (($view->name == 'News' && $view->current_display == 'block_1') || ($view->name == 'News' && $view->current_display == 'attachment_1')) { //If the attachment has a result nid then it has an advert to display so mark alter_num_results as true if($view->current_display == 'attachment_1' && $view->result[0]->nid){ $alter_num_results = 'TRUE'; } //If the marker is true then unset the 3rd item if($view->current_display == 'block_1' && $alter_num_results == 'TRUE'){ } } }
以上是关于钩子视图预渲染Drupal 6.x的主要内容,如果未能解决你的问题,请参考以下文章
在视图 2 (Drupal 6) 中检索被覆盖的主题钩子的名称