You are here

function theme_view in Views (for Drupal 7) 5

Returns a themed view.

Parameters

$view_name: The name of the view.

$limit: Maximum number of nodes displayed on one page. if $limit is set and $use_pager is not, this will be the maximum number of records returned. This is ignored if using a view set to return a random result. If NULL, the setting defined for the $view will be used.

$use_pager: If set, use a pager. Set this to the pager id you want it to use if you plan on using multiple pagers on a page. Note that the pager element id will be decremented in order to have the IDs start at 0. If NULL, the setting defined for the $view will be used.

$type: 'page' -- Produce output as a page, sent through theme. The only real difference between this and block is that a page uses drupal_set_title to change the page title. 'block' -- Produce output as a block, sent through theme. 'embed' -- Use this if you want to embed a view onto another page, and don't want any block or page specific things to happen to it.

$view_args: An array containing the arguments for the view

File

./views.module, line 2092

Code

function theme_view($view_name, $limit = NULL, $use_pager = NULL, $type = 'embed', $view_args = array()) {
  if ($view = views_get_view($view_name)) {
    $use_pager = isset($use_pager) ? $use_pager : $view->use_pager;
    $limit_default = $type == 'block' ? $view->nodes_per_block : $view->nodes_per_page;
    $limit = isset($limit) ? $limit : $limit_default;
    return views_build_view($type, $view, $view_args, $use_pager, $limit);
  }
}