ADVANCED VIEWSCONFIGURATION
About us!
Getting to know you...• Ever manage a large site in HTML only?• What other frameworks or CMSs have you used?• Ever use a c...
About us  • Drupal consulting,   development, and training  • Founded in 2007 by Alex and   Suzanne  • Help organizations ...
Our projects
INTRODUCTION:WHY VIEWS?
What do we have?• Content • Nodes (content types) • Taxonomy • Menus • Users • Blocks• Theme• Modules
What are we missing?• Organization of content • Lists of content • Related content blocks • Fancy lists (calendars and sli...
CONTENT DISPLAYAND ORGANIZATIONWITH VIEWS
Introduction to Views
Views: Query builder•   <?php    // Connecting, selecting database    $link = mysql_connect(mysql_host, mysql_user, mysql_...
Views wizard          Choose base table          Change types          Term filters          Simple sort
Views wizard          Page or block          Display settings          Add to menu
Views editor
1. Choose what to queryContent             Users           Taxonomy      CommentsContent title          D. Schrute        ...
2. Filter to Limit selection   • Limit a set of data to displayTitle                            Type         AuthorBeppu  ...
2. Filter to Limit selection   • Another example, filtering by author.Title                          Type         AuthorBep...
2. Filter to Limit selection   • ... or limit by content typeTitle                               Type         AuthorBeppu ...
3. Specify formatting
4. Choose a display                                                            Web Page Title              http://example....
Related content
Contextual filter• example.com/user/102 or example.com/member/eddie• Where are we on the site? What path?                 ...
About the Author
Our example• When viewing a course with the term “Philosophy...” it should display other content with the same term.• Buil...
Unit 1.3 - Exercise• Display related content across the site• Learn about ways to extend views.
Views styles
Views stylesRow styleView style
Views stylesUnformatted list - Teasers
Views styles                   Unformatted list - Fields           TitleTrimmed body  Thumbnail image
Views styles  Table - Fields
Views styles HTML list - Fields
Altering Field Output
Altering Field Output
Altering Field Output
Altering Field Output
ADVANCED VIEWS
Filtering options
How can you filter   content?  Choose a field to filter by
Operators for Filters       Does the field exist?Is the field equal a certain value?
Allowing users to filter       content
Modules for Filtering• Better Exposed Filters • Provides more options for exposed filters• Views Dependent Filters • Expose...
Views relationships
Views Relationships• Join a Views result to a related record, so you can show fields from that record• Examples:   • The au...
Add Relationship to an        Instructor Node      Course                          InstructorCourse Title                 ...
Add Relationship to an   Instructor Node
Adding a Relationship
Extending Views:Views Displays
Extending Views• Views Slideshow• Views Accordion• Calendar
Configuring Views Styles
Views Slideshow
Views Slideshow Config
Views Accordion
Calendar
Calendar Config
Administrative Views
Administrative Views         Modules• Draggable Views• Administrative Views• Views Bulk Operations
Administrative Views
Draggable Views
Draggable Views
Views Bulk Operations
More Views Features
Previewing Output
Viewing the Query
Exporting Views
Views Attachments
Theme Information
Theme Information
Q+A
Upcoming SlideShare
Loading in...5
×

Advanced Views Configuration: Presentation from DrupalCamp Montreal 2012

965

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
965
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Advanced Views Configuration: Presentation from DrupalCamp Montreal 2012

  1. 1. ADVANCED VIEWSCONFIGURATION
  2. 2. About us!
  3. 3. Getting to know you...• Ever manage a large site in HTML only?• What other frameworks or CMSs have you used?• Ever use a custom CMS?• Ever build your own CMS?• What challenges did you find?
  4. 4. About us • Drupal consulting, development, and training • Founded in 2007 by Alex and Suzanne • Help organizations build awesome Drupal websites with custom functionality
  5. 5. Our projects
  6. 6. INTRODUCTION:WHY VIEWS?
  7. 7. What do we have?• Content • Nodes (content types) • Taxonomy • Menus • Users • Blocks• Theme• Modules
  8. 8. What are we missing?• Organization of content • Lists of content • Related content blocks • Fancy lists (calendars and slideshows)
  9. 9. CONTENT DISPLAYAND ORGANIZATIONWITH VIEWS
  10. 10. Introduction to Views
  11. 11. 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 HTML // Printing results in HTML echo "<table>n"; echo "<table>n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "t<tr>n"; while ($line = mysql_fetch_array($result, foreach ($line as $col_value) { } MYSQL_ASSOC)) { echo "tt<td>$col_value</td>n"; echo "t</tr>n"; echo "t<tr>n"; } echo "</table>n"; foreach ($line as $col_value) { // Free resultset echo "tt<td>$col_value</td>n"; mysql_free_result($result); } // Closing connection mysql_close($link); echo "t</tr>n"; ?> } echo "</table>n";
  12. 12. Views wizard Choose base table Change types Term filters Simple sort
  13. 13. Views wizard Page or block Display settings Add to menu
  14. 14. Views editor
  15. 15. 1. Choose what to queryContent Users Taxonomy CommentsContent title D. Schrute adventure Wow, cant Germany city breakwait to get dwight city break 8 Sept visit. J. Halpert Spain sailing joe Me too! shopping 8 Sept
  16. 16. 2. Filter to Limit selection • Limit a set of data to displayTitle Type AuthorBeppu City guide EddieLost luggage Article JillFAQ Basic page JoeParis City guide SusanWhat we do Basic page SabaAbout us Basic page Saba
  17. 17. 2. Filter to Limit selection • Another example, filtering by author.Title Type AuthorBeppu City guide EddieLost luggage Article JillFAQ Basic page JoeParis City guide SusanWhat we do Basic page SabaAbout us Basic page Saba
  18. 18. 2. Filter to Limit selection • ... or limit by content typeTitle Type AuthorBeppu City guide City guide EddieLost luggage Article JillFAQ Basic page JoeParis City guide City guide SusanWhat we do Basic page SabaAbout us Basic page Saba
  19. 19. 3. Specify formatting
  20. 20. 4. Choose a display Web Page Title http://example.com/city-guides Google Page display (banner)City guides Sign upBeppu nameFar far away, behind the word mountains, far from the countries Vokalia andConsonantia, there live the blind texts. Separated they live in Bookmarksgrove right atthe coast of the Semantics, a large language ocean. email Block display ButtonParisFar far away, behind the word mountains, far from the countries Vokalia andConsonantia, there live the blind texts. Separated they live in Bookmarksgrove right at City guides by topicthe coast of the Semantics, a large language ocean. Budget City breakMali FamilyFar far away, behind the word mountains, far from the countries Vokalia and LuxuryConsonantia, there live the blind texts. Separated they live in Bookmarksgrove right at Sun and seathe coast of the Semantics, a large language ocean.
  21. 21. Related content
  22. 22. Contextual filter• example.com/user/102 or example.com/member/eddie• Where are we on the site? What path? Eddie Eddie likes to travel with his mandolin. Or sometimes the ukelele. In a pinch, hell travel with just his tambourine. By this contributor... Best in Beppu Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. Paris excursions Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. Mali music
  23. 23. About the Author
  24. 24. Our example• When viewing a course with the term “Philosophy...” it should display other content with the same term.• Build each view per term? No.• Use “Contextual filter” to pull in the related content”.
  25. 25. Unit 1.3 - Exercise• Display related content across the site• Learn about ways to extend views.
  26. 26. Views styles
  27. 27. Views stylesRow styleView style
  28. 28. Views stylesUnformatted list - Teasers
  29. 29. Views styles Unformatted list - Fields TitleTrimmed body Thumbnail image
  30. 30. Views styles Table - Fields
  31. 31. Views styles HTML list - Fields
  32. 32. Altering Field Output
  33. 33. Altering Field Output
  34. 34. Altering Field Output
  35. 35. Altering Field Output
  36. 36. ADVANCED VIEWS
  37. 37. Filtering options
  38. 38. How can you filter content? Choose a field to filter by
  39. 39. Operators for Filters Does the field exist?Is the field equal a certain value?
  40. 40. Allowing users to filter content
  41. 41. Modules for Filtering• Better Exposed Filters • Provides more options for exposed filters• Views Dependent Filters • Exposed filters that show up when a particular option is selected• Date Views • Filters based on date fields
  42. 42. Views relationships
  43. 43. Views Relationships• Join a Views result to a related record, so you can show fields from that record• Examples: • The author of a node • A related node, linked to with an entity reference field • The translation of a node
  44. 44. Add Relationship to an Instructor Node Course InstructorCourse Title NameDepartment Field Specialty FieldCourse No. Field Entity ReferenceInstructor Field
  45. 45. Add Relationship to an Instructor Node
  46. 46. Adding a Relationship
  47. 47. Extending Views:Views Displays
  48. 48. Extending Views• Views Slideshow• Views Accordion• Calendar
  49. 49. Configuring Views Styles
  50. 50. Views Slideshow
  51. 51. Views Slideshow Config
  52. 52. Views Accordion
  53. 53. Calendar
  54. 54. Calendar Config
  55. 55. Administrative Views
  56. 56. Administrative Views Modules• Draggable Views• Administrative Views• Views Bulk Operations
  57. 57. Administrative Views
  58. 58. Draggable Views
  59. 59. Draggable Views
  60. 60. Views Bulk Operations
  61. 61. More Views Features
  62. 62. Previewing Output
  63. 63. Viewing the Query
  64. 64. Exporting Views
  65. 65. Views Attachments
  66. 66. Theme Information
  67. 67. Theme Information
  68. 68. Q+A

×