Tips and Tricks for Gettingthe Most out of Views
About me• Drupal consulting,development, andtraining• Help organizations buildawesome Drupalwebsites with customfunctional...
Introduction to Views
What is Views?FieldsSortsFiltersViewTaxonomycity breakCommentsUsersD. SchruteGermanyJ. HalpertSpainadventurecity breaksail...
Views BasicsTaxonomycity breakCommentsUsersD. SchruteGermanyJ. HalpertSpainadventurecity breaksailingshoppingdwight8 SeptW...
Choose What to ListTaxonomycity breakCommentsUsersD. SchruteGermanyJ. HalpertSpainadventurecity breaksailingshoppingdwight...
Add Filters & SortsSort by titleSort by post dateFilter by content typeArticles Job PostingsJan 10March 16April 6April 28A...
Choose a FormatUnformatted HTML List Ordered ListTable Calendar Map
Choose a DisplayWebsite Header Block DisplayPage DisplayRSS Feed DisplayAttachment Display
Anatomy of a ViewArticlesWelcome to the articles page.TitleHeaderRowFirst | Prev | 1 | 2 | 3 | Next | Last PagerResults
Anatomy of a ViewArticlesWelcome to the articles page.TitleHeaderRowFirst | Prev | 1 | 2 | 3 | Next | Last PagerResults
Views: Query builder• <?php// Connecting, selecting database$link = mysql_connect(mysql_host, mysql_user, mysql_password)o...
Views WizardChoose base tableChange typesTerm filtersSimple sort
Views WizardPage or blockDisplay settingsAdd to menu
Views Editor
CHANGING THEMARKUP
Choose a FormatUnformatted HTML List Ordered ListTable Calendar Map
Choose the rightformat
Built-in Formats• Table• Unformatted List• HTML List• Jump List• Grid
Use grids for visualdata
Use tables for tabulardata
Display ‘Fields’ formore Control
Change the row styleRow style setting
Row StylesFields ContentSelect the exact fields thatyou want to displaySelect the view mode to useSelect a row style (conte...
Change the markupfor fields inconfiguration
Altering Field Output
Exclude fields andrewrite results
Altering Field Output
Altering Field Output
Use Field Formatters
http://blog.brightcove.com
http://www.builtinchicago.org/community/spotlight-videos
Use custom viewmodes
Define custom Viewmodes with Display Suite
Add multiple displaysto the same View
Multiple Displays
Add displaysAdd displays
Override SettingsSelect to change settings for the current display or all displays
Use attachments tomake a ‘featureditem’
Group results foreasy scanning
Select grouping field
Use Views to CreateRSS Feeds
Attach a Feed Display
Link a block to a pagedisplay
Link a block to a pageLink display setting
FILTERING ANDSORTING
Add Filters & SortsSort by titleSort by post dateFilter by content typeArticles Job PostingsJan 10March 16April 6April 28A...
Adding FiltersAdd something to filter byConfigure it
Filter by whether afield exists
Operators for FiltersFilter toshow onlyusers whohave apicture.
Use exposed filters tolet users filter content
Exposing a filter
Modules for Filtering• Better Exposed Filters• Provides more options for exposed filters• Views Dependent Filters• Exposed ...
Use exposed filtersfor search
Exposing Search• Provide a ‘keywords’ exposed filter
Exposing Search
Display content in atable and exposesorts
Exposed Sorts• Use a table view and expose sorts to users
Exposed Sorts
Use the Date Viewsmodule
Upcoming Events View
Filtering by DateFilter to onlyshowresults witha start datein the future
USING CONTEXTUALFILTERS ANDRELATIONSHIPS
Contextual Filters: PageWebsite HeaderPage DisplayAlias: category/tags/drupalDrupal System Path: taxonomy/term/1Content Ab...
Contextual Filters: PageAdd a contextual filterConfigure it
Contextual Filters: BlockWebsite HeaderBlock DisplayAlias: content/blog-post-titleDrupal System Path: node/1URL: evolvingw...
Contextual Filters: BlockAdd a contextual filterConfigure it
Use contextual filtersto show relatedcontent
Field in Separate BlockView showing thetechnology field. Usescontextual filter to showonly data for current node.
Related Media BlockView showing the ‘RelatedVideos’ field. Usescontextual filter to showonly data for current node.
Use contextual filtersto exclude results
Exclude current node
Exclude arguments
EXTENDING VIEWS
Setup Views foradministrators
Administrative Views
Draggable Views
Draggable Views
Views Bulk Operations
Use Views & ApacheSolr
Apache Solr• Apache Solr Views Integration module
Display more datawith Views
What else can you showwith Views?• Aggregator items• Solr search results• Content Revisions• Products• Media• Webform Subm...
Your Custom Data• hook_views_data• Tell Views about the custom data that you’veadded with your module• http://evolvingweb....
Your Custom Data
Use Views Slideshowfor dynamic rotators
Views Slideshow
Views Slideshow Config
Use the CalendarModule
Calendarhttps://buyandsell.gc.ca/event-calendar
https://ed.stanford.edu/events
Building a Calendar• Calendar provides a views template
Maps!
Open Layers Viewshttp://www.gfptt.org/
WORKING WITHVIEWS
Preview Output
Previewing Output
Export Your Views
Views in CodeExport ViewsAdd Views to Your Features
Use the ‘ThemeInformation’ link
Theme Information
Theme Information
Upcoming Views TrainingOttawa - May 13thhttp://drupal-views-training-ottawa-may13.eventbrite.comPortland - May 20thhttp://...
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Tips and Tricks for Getting the Most out of Views
Upcoming SlideShare
Loading in...5
×

Tips and Tricks for Getting the Most out of Views

1,019

Published on

Published in: Technology

Tips and Tricks for Getting the Most out of Views

  1. 1. Tips and Tricks for Gettingthe Most out of Views
  2. 2. About me• Drupal consulting,development, andtraining• Help organizations buildawesome Drupalwebsites with customfunctionality@suzanne_kennedyevolvingweb.ca
  3. 3. Introduction to Views
  4. 4. What is Views?FieldsSortsFiltersViewTaxonomycity breakCommentsUsersD. SchruteGermanyJ. HalpertSpainadventurecity breaksailingshoppingdwight8 SeptWow, cantwait to getvisit.joe8 SeptMe too!ContentContent titleData
  5. 5. Views BasicsTaxonomycity breakCommentsUsersD. SchruteGermanyJ. HalpertSpainadventurecity breaksailingshoppingdwight8 SeptWow, cantwait to getvisit.joe8 SeptMe too!ContentContent titleChoose what to listChoose a formatChoose a display typeUnformatted List TableAdd filters and sortsWebsite Header Block DisplayPage Display
  6. 6. Choose What to ListTaxonomycity breakCommentsUsersD. SchruteGermanyJ. HalpertSpainadventurecity breaksailingshoppingdwight8 SeptWow, cantwait to getvisit.joe8 SeptMe too!ContentContent title
  7. 7. Add Filters & SortsSort by titleSort by post dateFilter by content typeArticles Job PostingsJan 10March 16April 6April 28Ascending DescendingJan 10March 16April 6April 28AscendingAZZADescending
  8. 8. Choose a FormatUnformatted HTML List Ordered ListTable Calendar Map
  9. 9. Choose a DisplayWebsite Header Block DisplayPage DisplayRSS Feed DisplayAttachment Display
  10. 10. Anatomy of a ViewArticlesWelcome to the articles page.TitleHeaderRowFirst | Prev | 1 | 2 | 3 | Next | Last PagerResults
  11. 11. Anatomy of a ViewArticlesWelcome to the articles page.TitleHeaderRowFirst | Prev | 1 | 2 | 3 | Next | Last PagerResults
  12. 12. Views: Query builder• <?php// Connecting, selecting database$link = mysql_connect(mysql_host, mysql_user, mysql_password)or die(Could not connect: . mysql_error());echo Connected successfully;mysql_select_db(my_database) or die(Could not select database);// Performing SQL query$query = SELECT * FROM my_table;$result = mysql_query($query) or die(Query failed: . mysql_error());// Printing results in HTMLecho "<table>n";while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {echo "t<tr>n";foreach ($line as $col_value) {echo "tt<td>$col_value</td>n";}echo "t</tr>n";}echo "</table>n";// Free resultsetmysql_free_result($result);// Closing connectionmysql_close($link);?>• // Printing results in HTMLecho "<table>n";while ($line = mysql_fetch_array($result,MYSQL_ASSOC)) {echo "t<tr>n";foreach ($line as $col_value) {echo "tt<td>$col_value</td>n";}echo "t</tr>n";}echo "</table>n";
  13. 13. Views WizardChoose base tableChange typesTerm filtersSimple sort
  14. 14. Views WizardPage or blockDisplay settingsAdd to menu
  15. 15. Views Editor
  16. 16. CHANGING THEMARKUP
  17. 17. Choose a FormatUnformatted HTML List Ordered ListTable Calendar Map
  18. 18. Choose the rightformat
  19. 19. Built-in Formats• Table• Unformatted List• HTML List• Jump List• Grid
  20. 20. Use grids for visualdata
  21. 21. Use tables for tabulardata
  22. 22. Display ‘Fields’ formore Control
  23. 23. Change the row styleRow style setting
  24. 24. Row StylesFields ContentSelect the exact fields thatyou want to displaySelect the view mode to useSelect a row style (content or fields)
  25. 25. Change the markupfor fields inconfiguration
  26. 26. Altering Field Output
  27. 27. Exclude fields andrewrite results
  28. 28. Altering Field Output
  29. 29. Altering Field Output
  30. 30. Use Field Formatters
  31. 31. http://blog.brightcove.com
  32. 32. http://www.builtinchicago.org/community/spotlight-videos
  33. 33. Use custom viewmodes
  34. 34. Define custom Viewmodes with Display Suite
  35. 35. Add multiple displaysto the same View
  36. 36. Multiple Displays
  37. 37. Add displaysAdd displays
  38. 38. Override SettingsSelect to change settings for the current display or all displays
  39. 39. Use attachments tomake a ‘featureditem’
  40. 40. Group results foreasy scanning
  41. 41. Select grouping field
  42. 42. Use Views to CreateRSS Feeds
  43. 43. Attach a Feed Display
  44. 44. Link a block to a pagedisplay
  45. 45. Link a block to a pageLink display setting
  46. 46. FILTERING ANDSORTING
  47. 47. Add Filters & SortsSort by titleSort by post dateFilter by content typeArticles Job PostingsJan 10March 16April 6April 28Ascending DescendingJan 10March 16April 6April 28AscendingAZZADescending
  48. 48. Adding FiltersAdd something to filter byConfigure it
  49. 49. Filter by whether afield exists
  50. 50. Operators for FiltersFilter toshow onlyusers whohave apicture.
  51. 51. Use exposed filters tolet users filter content
  52. 52. Exposing a filter
  53. 53. Modules for Filtering• Better Exposed Filters• Provides more options for exposed filters• Views Dependent Filters• Exposed filters that show up when aparticular option is selected
  54. 54. Use exposed filtersfor search
  55. 55. Exposing Search• Provide a ‘keywords’ exposed filter
  56. 56. Exposing Search
  57. 57. Display content in atable and exposesorts
  58. 58. Exposed Sorts• Use a table view and expose sorts to users
  59. 59. Exposed Sorts
  60. 60. Use the Date Viewsmodule
  61. 61. Upcoming Events View
  62. 62. Filtering by DateFilter to onlyshowresults witha start datein the future
  63. 63. USING CONTEXTUALFILTERS ANDRELATIONSHIPS
  64. 64. Contextual Filters: PageWebsite HeaderPage DisplayAlias: category/tags/drupalDrupal System Path: taxonomy/term/1Content About ‘Drupal’Views Configuration: taxonomy/term/%URL: evolvingweb.ca/category/tags/drupal
  65. 65. Contextual Filters: PageAdd a contextual filterConfigure it
  66. 66. Contextual Filters: BlockWebsite HeaderBlock DisplayAlias: content/blog-post-titleDrupal System Path: node/1URL: evolvingweb.ca/content/blog-post-titleNode 1 ContentTags for Node 1
  67. 67. Contextual Filters: BlockAdd a contextual filterConfigure it
  68. 68. Use contextual filtersto show relatedcontent
  69. 69. Field in Separate BlockView showing thetechnology field. Usescontextual filter to showonly data for current node.
  70. 70. Related Media BlockView showing the ‘RelatedVideos’ field. Usescontextual filter to showonly data for current node.
  71. 71. Use contextual filtersto exclude results
  72. 72. Exclude current node
  73. 73. Exclude arguments
  74. 74. EXTENDING VIEWS
  75. 75. Setup Views foradministrators
  76. 76. Administrative Views
  77. 77. Draggable Views
  78. 78. Draggable Views
  79. 79. Views Bulk Operations
  80. 80. Use Views & ApacheSolr
  81. 81. Apache Solr• Apache Solr Views Integration module
  82. 82. Display more datawith Views
  83. 83. What else can you showwith Views?• Aggregator items• Solr search results• Content Revisions• Products• Media• Webform Submissions• Files
  84. 84. Your Custom Data• hook_views_data• Tell Views about the custom data that you’veadded with your module• http://evolvingweb.ca/story/developing-views-part-i-describing-your-data-views
  85. 85. Your Custom Data
  86. 86. Use Views Slideshowfor dynamic rotators
  87. 87. Views Slideshow
  88. 88. Views Slideshow Config
  89. 89. Use the CalendarModule
  90. 90. Calendarhttps://buyandsell.gc.ca/event-calendar
  91. 91. https://ed.stanford.edu/events
  92. 92. Building a Calendar• Calendar provides a views template
  93. 93. Maps!
  94. 94. Open Layers Viewshttp://www.gfptt.org/
  95. 95. WORKING WITHVIEWS
  96. 96. Preview Output
  97. 97. Previewing Output
  98. 98. Export Your Views
  99. 99. Views in CodeExport ViewsAdd Views to Your Features
  100. 100. Use the ‘ThemeInformation’ link
  101. 101. Theme Information
  102. 102. Theme Information
  103. 103. Upcoming Views TrainingOttawa - May 13thhttp://drupal-views-training-ottawa-may13.eventbrite.comPortland - May 20thhttp://portland2013.drupal.org/node/3718
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×