0
Getting the most out of Views 2.0<br />Jay Callicott<br />September 19, 2009<br />Drupal Camp Atlanta<br />
Introduction: Session Outline<br />Introduction to Views 2.0<br />Why views?<br />Advantages of using views over database ...
Introduction: Informal Poll<br />How many beginner Drupal developers?<br />Advanced?<br />How many non-developers?<br />Ho...
Introduction: Intended Audience<br />Beginner to advanced developers<br />The material is more advanced but I will try to ...
Introduction: Who Am I?<br />Jay Callicott<br />Mediacurrent web developer<br />Drupal developer since 4.6<br />Started us...
Introduction: What are views?<br />Views are a critical feature of Drupal<br />As big as CCK, robust theming layer, modula...
Introduction: Why did I create this session?<br />This session is more me 1 year ago.<br />Intended for someone who has us...
Why views? Advantages of using views over database queries<br />The usual alternative to views is the quick db query<br />...
Views vsdb_query comparison chart<br />
More Views vsdb_query comparison chart<br />
Db query vs Views – side by side comparison<br />We will go screen by screen<br />First create a module using custom db qu...
Enabling the module…<br />
Enabling the block…<br />
Viola! Recent Stories Block v1<br />
Recent Stories Block v2<br />
Let’s Add a Subtitle! (Using CCK)<br />
Need phpMyAdmin to analyze CCK<br />
My first attempt = MySQL error<br />
Recent Stories Block v3 – We’re done!<br />
First screen<br />
Add a filter…<br />
Add a filter step 2<br />
Add a limit (3)<br />
Add a sort…<br />
Add a sort step 2<br />
Add style…<br />
Add subtitle…<br />
Add subtitle step 2<br />
Add title link…<br />
Add title link step 2<br />
We’re done! Time to save.<br />
Live preview!<br />
Enable the recent stories block…<br />
We’re done!<br />
Theme-centric vs logic-centric approach to view creation<br />Methodology is critical<br />Especially with large projects<...
Theme-centric – aka look & feel<br />Simple list<br />Add displays for recent articles, recommended articles, popular, gea...
Logic-centric methodology<br />Recent articles<br />Add displays for species articles, gear articles / add displays for bl...
Comparing the 2 approaches<br />Both approaches sound reasonable<br />My experience building around look & feel is much mo...
Comparing Approaches: L&F<br />Sharing templates is easier<br />Look is the same/similar you should share CSS<br />Won’t h...
Comparing Approaches: Logic<br />Maybe share templates<br />What if the logic is similar but the look is different?<br />S...
More on Logic regarding templates and CSS<br />You have a recent articles block and a popular articles block across 2 view...
Comparing Approaches: L&F v. Logic<br />Look & Feel<br />You will override fields and some filters<br />All the styles wil...
A Case Study on 2 Approaches<br />
Guns admin view list…<br />
Guns short teaser admin edit…<br />
Guns short teaser admin edit #2…<br />
Gun short teaser image CSS…<br />
Petersen’s Hunting…<br />
Hunting view admin screen…<br />
Hunting Recommended Article CSS…<br />
Wrap-up<br />Covered basics of views, in detail why we should use them over custom code<br />Showed side-by-side how creat...
Q&A<br />Can views do ‘X/Y/Z’?<br />Your specific business problem, can views help?<br />General questions about Drupal? M...
Upcoming SlideShare
Loading in...5
×

Jay Callicott Drupal Views 2.0 Presentation

2,519

Published on

Introduction to Views 2.0
Why views?
Advantages of using views over database queries
Db query vs Views side by side comparison
Theme-centric vs Logic-centric approaches to view creation
A case study on 2 main strategies for creating views
Views 2.0 Wrap Up & Q&A

Published in: Technology, Travel
3 Comments
1 Like
Statistics
Notes
  • Node statistics I think is built in, I haven't installed any additional views modules, the your default package. It should show up for you out of the box, thx -J
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • On slide 50, I saw you used Node statistics. Does it come with a module or something? Do you have any recommend module for keeping node stat?? Thanks in advance
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hey...Thanks!!! an example in your slide just reminded + showed me how easy to use View to something i want. LOL I almost write a module. :)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
2,519
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
44
Comments
3
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Jay Callicott Drupal Views 2.0 Presentation"

  1. 1. Getting the most out of Views 2.0<br />Jay Callicott<br />September 19, 2009<br />Drupal Camp Atlanta<br />
  2. 2. Introduction: Session Outline<br />Introduction to Views 2.0<br />Why views?<br />Advantages of using views over database queries<br />Db query vs Views side by side comparison<br />Theme-centric vs Logic-centric approaches to view creation<br />A case study on 2 main strategies for creating views<br />Views 2.0 Wrap Up & Q&A<br />
  3. 3. Introduction: Informal Poll<br />How many beginner Drupal developers?<br />Advanced?<br />How many non-developers?<br />How many here came to the conference for kicking the tires of Drupal?<br />Training?<br />
  4. 4. Introduction: Intended Audience<br />Beginner to advanced developers<br />The material is more advanced but I will try to not lose beginners<br />Business Guys (Managers/Owners/CIOs) wanting to learn the power of Drupal<br />
  5. 5. Introduction: Who Am I?<br />Jay Callicott<br />Mediacurrent web developer<br />Drupal developer since 4.6<br />Started using Drupal in a part-time business I started several years ago<br />Developed web applications for the state of Arkansas before this job<br />Expert in PHP/mySQL and Drupal as well<br />worked with Drupal versions: 4.6 / 4.7 / 5 / now 6<br />
  6. 6. Introduction: What are views?<br />Views are a critical feature of Drupal<br />As big as CCK, robust theming layer, modular framework<br />*Will be rolled into Drupal 7.0 core<br />*Edit, this is not correct – I think I got confused with CCK?<br />Views are for building arbitrary lists of content.<br />Not unlike “lists” in Sharepoint, other CMS’s might have similar concepts<br />Views can be blocks, pages, embedded<br />Views can pull any type of Drupal content (nodes/users/etc) and do some amazing things all from the UI! <br />
  7. 7. Introduction: Why did I create this session?<br />This session is more me 1 year ago.<br />Intended for someone who has used Drupal, even beginner-level who is trying to get a grasp of Views 2.0<br />Or for Drupal 5 developers getting a handle on the transition of Views 1.0 to 2.0<br />Views 2.0 can look intimidating at first<br />
  8. 8. Why views? Advantages of using views over database queries<br />The usual alternative to views is the quick db query<br />Fetch results in module, spit out html<br />Absolute control!<br />Tempting if you are used to custom coding<br />Fine for quick? Or is it?<br />As requirements grow, code grows and maintenance becomes a problem<br />Views can do simple and can grow as requirements grow<br />Views are extremely flexible and scalable<br />
  9. 9. Views vsdb_query comparison chart<br />
  10. 10. More Views vsdb_query comparison chart<br />
  11. 11. Db query vs Views – side by side comparison<br />We will go screen by screen<br />First create a module using custom db query<br />Second create a view that does the same thing<br />
  12. 12.
  13. 13. Enabling the module…<br />
  14. 14. Enabling the block…<br />
  15. 15. Viola! Recent Stories Block v1<br />
  16. 16.
  17. 17. Recent Stories Block v2<br />
  18. 18. Let’s Add a Subtitle! (Using CCK)<br />
  19. 19. Need phpMyAdmin to analyze CCK<br />
  20. 20.
  21. 21. My first attempt = MySQL error<br />
  22. 22. Recent Stories Block v3 – We’re done!<br />
  23. 23.
  24. 24. First screen<br />
  25. 25. Add a filter…<br />
  26. 26. Add a filter step 2<br />
  27. 27. Add a limit (3)<br />
  28. 28. Add a sort…<br />
  29. 29. Add a sort step 2<br />
  30. 30. Add style…<br />
  31. 31. Add subtitle…<br />
  32. 32. Add subtitle step 2<br />
  33. 33. Add title link…<br />
  34. 34. Add title link step 2<br />
  35. 35. We’re done! Time to save.<br />
  36. 36. Live preview!<br />
  37. 37. Enable the recent stories block…<br />
  38. 38. We’re done!<br />
  39. 39. Theme-centric vs logic-centric approach to view creation<br />Methodology is critical<br />Especially with large projects<br />Views 2.0 methodology approaches: look & feel or logic<br />Documentation covers nuts & bolts, not strategy<br />Views 1.0 didn’t have this problem<br />Each list was usually it’s own view<br />With 2.0 you can combine lists together<br />
  40. 40. Theme-centric – aka look & feel<br />Simple list<br />Add displays for recent articles, recommended articles, popular, gear items, species<br />All displays get rolled up into 1 view<br />Image list<br />Image on left<br />Title, additional fields on the right<br />Featured item<br />1 content item from a content type, big image, more fields, etc.<br />
  41. 41. Logic-centric methodology<br />Recent articles<br />Add displays for species articles, gear articles / add displays for blocks / pages<br />Most popular<br />Add displays for species / gear / hunting / etc<br />Related articles<br />Gear, hunting articles that have a certain taxonomy term passed in through an argument<br />E.g. you pass in ‘deer’, ‘fish’, whatever and get articles that have that term<br />
  42. 42. Comparing the 2 approaches<br />Both approaches sound reasonable<br />My experience building around look & feel is much more maintainable and is more sustainable<br />Logic approach can lead to much frustration<br />
  43. 43. Comparing Approaches: L&F<br />Sharing templates is easier<br />Look is the same/similar you should share CSS<br />Won’t have to branch off .tpl templates for different content<br />
  44. 44. Comparing Approaches: Logic<br />Maybe share templates<br />What if the logic is similar but the look is different?<br />Some displays might be pages, some blocks<br />You could be forced to create a bunch of templates<br />Template explosion can occur!<br />
  45. 45. More on Logic regarding templates and CSS<br />You have a recent articles block and a popular articles block across 2 views.<br />Both have same look = similar .tpls and duplicated efforts<br />Bloated CSS<br />Views have different ids/classes (will show example later)<br />Template Duplication<br />Similar templates are created<br />Template customization gets duplicated<br />Maintenance becomes a nightmare<br />
  46. 46. Comparing Approaches: L&F v. Logic<br />Look & Feel<br />You will override fields and some filters<br />All the styles will be the same = consistency<br />Logic<br />You often override more here than in look & feel approach<br />Maybe styles and filters and fields<br />Views become very hard to maintain!<br />
  47. 47. A Case Study on 2 Approaches<br />
  48. 48.
  49. 49. Guns admin view list…<br />
  50. 50. Guns short teaser admin edit…<br />
  51. 51. Guns short teaser admin edit #2…<br />
  52. 52. Gun short teaser image CSS…<br />
  53. 53. Petersen’s Hunting…<br />
  54. 54.
  55. 55. Hunting view admin screen…<br />
  56. 56. Hunting Recommended Article CSS…<br />
  57. 57. Wrap-up<br />Covered basics of views, in detail why we should use them over custom code<br />Showed side-by-side how creating a view over code is often preferred<br />Covered 2 main approaches or strategies when creating views and the implications of these 2 main approaches<br />Displayed a real-world scenario and explained implications for each strategy<br />
  58. 58. Q&A<br />Can views do ‘X/Y/Z’?<br />Your specific business problem, can views help?<br />General questions about Drupal? Mediacurrent?<br />Got more questions later?<br />Jay.callicott@mediacurrent.com<br />or twitter http://twitter.com/drupalninja<br />Thanks for coming!<br />
  1. A particular slide catching your eye?

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

×