theme_view()

  1. /**
  2.  * Returns a themed view.
  3.  * @param $view_name
  4.  *    The name of the view.
  5.  * @param $limit
  6.  *   Maximum number of nodes displayed on one page. if $limit is set and $use_pager is
  7.  *   not, this will be the maximum number of records returned. This is ignored
  8.  *   if using a view set to return a random result.
  9.  *   If NULL, the setting defined for the $view will be used.
  10.  * @param $use_pager
  11.  *   If set, use a pager. Set this to the pager id you want it to use if you
  12.  *   plan on using multiple pagers on a page. Note that the pager element id
  13.  *   will be decremented in order to have the IDs start at 0.
  14.  *   If NULL, the setting defined for the $view will be used.
  15.  * @param $type
  16.  *    'page' -- Produce output as a page, sent through theme.
  17.  *      The only real difference between this and block is that
  18.  *      a page uses drupal_set_title to change the page title.
  19.  *    'block' -- Produce output as a block, sent through theme.
  20.  *    'embed' -- Use this if you want to embed a view onto another page,
  21.  *      and don't want any block or page specific things to happen to it.
  22.  * @param $view_args
  23.  *   An array containing the arguments for the view
  24.  */
  25. function theme_view($view_name, $limit = NULL, $use_pager = NULL, $type = 'embed', $view_args = array()) {
  26.   if ($view = views_get_view($view_name)) {
  27.     $use_pager = isset($use_pager) ? $use_pager : $view->use_pager;
  28.     $limit_default = ($type == 'block') ? $view->nodes_per_block : $view->nodes_per_page;
  29.     $limit = isset($limit) ? $limit : $limit_default;
  30.     return views_build_view($type, $view, $view_args, $use_pager, $limit);
  31.   }
  32. }
  33.  
  34.  
  35. theme('view', $view_name, $limit = NULL, $use_pager = NULL, $type = 'embed', $view_args = array())