Drupal: View for Image Gallery


/ Published in: Other
Save to your folder(s)

View to use with the docs at http://drupal.org/node/144725 for creating image gallery using cck, views and thickbox.


Copy this code and paste it in your HTML
  1. $view = new stdClass();
  2. $view->name = 'image_gallery';
  3. $view->description = 'Image gallery photos uploaded by users.';
  4. $view->access = array (
  5. );
  6. $view->view_args_php = '';
  7. $view->page = TRUE;
  8. $view->page_title = 'Image Gallery';
  9. $view->page_header = '';
  10. $view->page_header_format = '1';
  11. $view->page_footer = '';
  12. $view->page_footer_format = '1';
  13. $view->page_empty = '';
  14. $view->page_empty_format = '1';
  15. $view->page_type = 'bonus_grid';
  16. $view->url = 'gallery';
  17. $view->use_pager = TRUE;
  18. $view->nodes_per_page = '24';
  19. $view->sort = array (
  20. );
  21. $view->argument = array (
  22. );
  23. $view->field = array (
  24. array (
  25. 'tablename' => 'node',
  26. 'field' => 'title',
  27. 'label' => '',
  28. 'handler' => 'views_handler_field_nodelink',
  29. 'options' => 'link',
  30. ),
  31. array (
  32. 'tablename' => 'node_data_field_image',
  33. 'field' => 'field_image_fid',
  34. 'label' => '',
  35. 'handler' => 'content_views_field_handler_ungroup',
  36. 'options' => 'thickbox][square-thumbnail',
  37. ),
  38. );
  39. $view->filter = array (
  40. array (
  41. 'tablename' => 'node',
  42. 'field' => 'status',
  43. 'operator' => '=',
  44. 'options' => '',
  45. 'value' => '1',
  46. ),
  47. array (
  48. 'tablename' => 'node',
  49. 'field' => 'type',
  50. 'operator' => 'OR',
  51. 'options' => '',
  52. 'value' => array (
  53. 0 => 'gallery_image',
  54. ),
  55. ),
  56. );
  57. $view->exposed_filter = array (
  58. );
  59. $view->requires = array(node, node_data_field_image);
  60. $views[$view->name] = $view;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.