Guest User

Untitled

a guest
Jul 28th, 2011
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.06 KB | None | 0 0
  1.     global $language;
  2.    
  3.     //create a new view
  4.     $view = views_new_view();
  5.     //define the view (this code was generated by the Export)
  6.     $view->name = 'products';
  7.     $view->description = '';
  8.     $view->tag = '';
  9.     $view->view_php = '';
  10.     $view->base_table = 'node';
  11.     $view->is_cacheable = FALSE;
  12.     $view->api_version = 2;
  13.     $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  14.     $handler = $view->new_display('default', 'Defaults', 'default');
  15.     $handler->override_option('fields', array(
  16.       'title' => array(
  17.         'label' => 'Title',
  18.         'alter' => array(
  19.           'alter_text' => 0,
  20.           'text' => '',
  21.           'make_link' => 0,
  22.           'path' => '',
  23.           'alt' => '',
  24.           'prefix' => '',
  25.           'suffix' => '',
  26.           'help' => '',
  27.           'trim' => 0,
  28.           'max_length' => '',
  29.           'word_boundary' => 1,
  30.           'ellipsis' => 1,
  31.           'html' => 0,
  32.         ),
  33.         'link_to_node' => 1,
  34.         'exclude' => 0,
  35.         'id' => 'title',
  36.         'table' => 'node',
  37.         'field' => 'title',
  38.         'relationship' => 'none',
  39.       ),
  40.     ));
  41.    
  42.     $handler->override_option('filters', array(
  43.         'status'    => array(
  44.             'operator' => '=',
  45.             'value' => '1',
  46.             'group' => '0',
  47.             'exposed' => FALSE,
  48.             'expose' => array(
  49.                     'operator' => FALSE,
  50.                     'label' => ''
  51.                 ),
  52.             'id' => 'status',
  53.             'table' => 'node',
  54.             'field' => 'status',
  55.             'relationship' => 'none'
  56.         ),
  57.         'language'  => array(
  58.             'operator' => '=',
  59.             'value' => array(
  60.                 $language->language => $language->language,
  61.                 'und' => 'und'
  62.             ),
  63.             'group' => '0',
  64.             'exposed' => false,
  65.             'expose' => array(
  66.                     'operator' => false,
  67.                     'label' => ''
  68.                 ),
  69.             'id' => 'language',
  70.             'table' => 'node',
  71.             'field' => 'language',
  72.             'relationship' => 'none'
  73.         )
  74.        
  75.     ));
  76.    
  77.     $handler->override_option('access', array(
  78.       'type' => 'none',
  79.     ));
  80.     $handler->override_option('cache', array(
  81.       'type' => 'none',
  82.     ));
  83.     $handler->override_option('row_options', array(
  84.       'inline' => array(),
  85.       'separator' => '',
  86.     ));
  87.     // now output the view (or whatever you want to do with it)
  88.     print $view->execute_display('default', array());
Advertisement
Add Comment
Please, Sign In to add comment