Return to Snippet

Revision: 14458
at June 4, 2009 13:51 by troynt


Initial Code
<?php
/**
* Implements hook_views_pre_execute().
*
* This allows us to adjust the number of rows to present, and to add the pager
* count display functionality.
*
* @param stdClass $view The view to alter.
*/
function YOURMODULEHERE_views_pre_execute(&$view) {
    $show = $_GET['show'];
    if( $show == 'all' ) $show = 0;

    if( is_numeric($show) )
    {
      $view->pager['items_per_page'] = $show;
      $view->handler->options['items_per_page'] = $show;
    }
}
?>

Initial URL


Initial Description
Use the following module code to add a Show parameter to your URL.

Initial Title
Items Per Page Get Parameter for Views

Initial Tags


Initial Language
PHP