Revision: 22301
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 8, 2010 08:54 by ReeceMarsland
Initial Code
/** * 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'){ unset($view->result[2]); } } }
Initial URL
Initial Description
Initial Title
hook_views_pre_render Drupal 6.x
Initial Tags
drupal
Initial Language
PHP