Part 3: Backing upyour views!acquia.com1Wednesday, May 15, 2013
Heather JamesManager of Training at AcquiaHELLO!@learningdrupal@hjames2Wednesday, May 15, 2013
Acquia Traininghttp://training.acquia.com3Wednesday, May 15, 2013
In todayʼs webinar!• Views mini course- May 2nd: Introduction to Views- May 8th: How to build flexible views- May 15th: Bui...
Notes online!5Wednesday, May 15, 2013
What weʼre doing today• Best practices to finish your view• Caching• Backing up views• If we have time: Theming Views - qui...
What you need to know already!• How to add content• How to customize content types (add fields)• What modules are• How to i...
FINISHING YOURVIEWSFinal checks8Wednesday, May 15, 2013
Final checks9Wednesday, May 15, 2013
Don’t forget! 123465710Wednesday, May 15, 2013
Views QAhttp://www.zivtech.com/blog/views-quality-checklist11Wednesday, May 15, 2013
Disable the Views UI• Finished? Disable the Views UI module.•12Wednesday, May 15, 2013
Tip!• Enabled modules eat your memory. If it’s notin use- Disable it!• If you’re never going to use it again, uninstallit,...
Caching14Wednesday, May 15, 2013
All done?• Enable caching to store query and output.15Wednesday, May 15, 2013
Site caching basics• Set lifetime to minimum 5 minutes.• Will your content editors freak out?https://www.acquia.com/blog/w...
Save your site• Read Hernani’s blog posts!https://www.acquia.com/blog/when-and-how-caching-can-save-your-site-part-2-authe...
What to cache• Blocks• Pages• Don’t cache admin views.• User bookmarks - places where peopleexpect immediate response.http...
Block cache type19Wednesday, May 15, 2013
Block cache20Wednesday, May 15, 2013
Debugging?• Disable caching when debugging21Wednesday, May 15, 2013
Demo• Block and page cache settings underperformance• Views cache options!22Wednesday, May 15, 2013
Smart cache option• Views content cache• http://drupal.org/project/views_content_cache23Wednesday, May 15, 2013
EXPORT TO AMODULEA better way24Wednesday, May 15, 2013
Dangerous• Views configuration is saved in the database.• Editing a view on a live site• Letting someone else edit the view...
Quick and dirty: Export26Wednesday, May 15, 2013
Import manually27Wednesday, May 15, 2013
Demo• Export code to a text file.• Easy!28Wednesday, May 15, 2013
Better: Export to module• In code instead of storing them in thedatabase.• Can managed by your version control system- eas...
hook_views_default_views()• http://api.drupal.org/api/views/views.api.php/function/hook_views_default_views/7• Allows you ...
Create a module• Two text files• deliciousdrupal.info• deliciousdrupal.moduleExample code available at http://j.mp/ZhgWFn 3...
Tip: Custom folder• Custom modules?• Add them in a “custom” folder.• /custom• /contrib32Wednesday, May 15, 2013
Info file• deliciousdrupal.infoExample code available at http://j.mp/ZhgWFn 33Wednesday, May 15, 2013
Module file• deliciousdrupal.module• Declare hook_views_api()• You can paste the exported view directly, butthat is messy....
Easier to maintain: Includes• Keep the includes in a separate folderExample code available at http://j.mp/ZhgWFn 35Wednesd...
Example code available at http://j.mp/ZhgWFn 36Wednesday, May 15, 2013
Easier to scale: Each view its own file• Export each view and allow your module toscan for new views.37Wednesday, May 15, ...
Demo: Backup a new view• Back up a view, adding to the module.• 1. New text file - machine name of view.• 2. Open with• 3. ...
Enable the moduleExample code available at http://j.mp/ZhgWFn 39Wednesday, May 15, 2013
Backed up!• Before:• After - protected from deletion40Wednesday, May 15, 2013
Clear cache• Views > Settings > Advanced41Wednesday, May 15, 2013
Database overriding code• Indicates that it’s in code and also saved indatabase.• Go to Views list to see your new viewsav...
Changes?• Working in staging site.• Your colleague “edits” a view and testschanges.• Export and save to your .views includ...
Add a new view?• Back up a view, adding to the module.• 1. New text file - machine name of view.• 2. Open with• 3. Paste ex...
Recap• Various states:• “In database” - Not exported to code• “Database overriding code”• “In code” - No changes saved in ...
Features• This works the same way as Features.• Basic module file• Exported code• This is what Features does for youautomat...
THEMING VIEWS47Wednesday, May 15, 2013
What you may expectMock upDesignCompsConfigureand buildsiteDrape overthemeDone!48Wednesday, May 15, 2013
“Markup megalomaniac”Design instatic HTMLand CSSConfigureprototypein corethemeModify TPL tomatch originalmarkupConfigureto...
“Skeleton and skin”Skeleton:Regions andCSS forstructureSkin:CSS for visualdesignDone!Contenttype designConfigureprototypeo...
Recap Views UI12543651Wednesday, May 15, 2013
Example• Recent comments View52Wednesday, May 15, 2013
Anatomy of a ViewViewThats great news! 50 min 32 sec agoOh I see, so even if i dont 4 weeks 52 min agoCustom subject headi...
Nested templatesDisplayFormat (style)FieldRowFieldFieldRowField54Wednesday, May 15, 2013
View default output• Depends on Views settings55Wednesday, May 15, 2013
Configure to customize• Modify format• Specify elements• Add classes• Strip markup• Strip default classes• Make some fields...
Example57Wednesday, May 15, 2013
Views base templates58Wednesday, May 15, 2013
Example59Wednesday, May 15, 2013
How can I find this?60Wednesday, May 15, 2013
Which is being used?61Wednesday, May 15, 2013
Display and format62Wednesday, May 15, 2013
Template suggestions• All fields (default)• All fields just in blocks• Any subject fields just in blocks• Just subject fields ...
OverridingCopy into your theme folder and rename64Wednesday, May 15, 2013
Rescan template files65Wednesday, May 15, 2013
Next up!• Check out the blog for notes from this 3 part class• Drupal essentials- May 22nd: Drupal Essentials: How to Confi...
Events! Learn in person• http://acquia.com/events• http://training.acquia.com/events• http://dublin2013.drupaldays.org/• h...
VIEWS NEXT STEPS!Your assignment68Wednesday, May 15, 2013
Your assignment• Last week you made a view, right?• This week:• Add a display with an attachment• Make a contextual filter ...
Views webinar!• Tips and Tricks for Getting the Most Out ofViews [April 30, 2013]• http://j.mp/mostviews• Suzanne Kennedy,...
Views tutorials• Quick version: 4 parts, 5 minseach!http://www.drupalgardens.com/content/new-views-tutorials-4-part-intro•...
TRAINING!72Wednesday, May 15, 2013
Course materials• Tested in hundreds ofclassrooms.• Continuously updated.• Clear and easy follow, butengaging content.• Bl...
The trainers are partners• Our trainers areexperienced developerswho love teaching.• They provide subjectmatter expertise ...
• Popular packages are typical examples of the tailoredpackages we have delivered.Tailored courses availablehttp://trainin...
Upcoming SlideShare
Loading in …5
×

Views Mini-Course, Part III: How to Back Up Your Views Safely

2,407 views

Published on

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

No Downloads
Views
Total views
2,407
On SlideShare
0
From Embeds
0
Number of Embeds
147
Actions
Shares
0
Downloads
36
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Views Mini-Course, Part III: How to Back Up Your Views Safely

  1. 1. Part 3: Backing upyour views!acquia.com1Wednesday, May 15, 2013
  2. 2. Heather JamesManager of Training at AcquiaHELLO!@learningdrupal@hjames2Wednesday, May 15, 2013
  3. 3. Acquia Traininghttp://training.acquia.com3Wednesday, May 15, 2013
  4. 4. In todayʼs webinar!• Views mini course- May 2nd: Introduction to Views- May 8th: How to build flexible views- May 15th: Build your first module to back up your views! <- Here!• Drupal essentials!- May 22nd: Drupal Essentials: How to Configure Accounts in Drupal• Drupal for Project Managers mini-course- May 29th-June 19th: 4 weeks - Drupal for Project Managers!Adam Boysen, Jakub Suchy, Amye Scavarda, Jenn Sramek4Wednesday, May 15, 2013
  5. 5. Notes online!5Wednesday, May 15, 2013
  6. 6. What weʼre doing today• Best practices to finish your view• Caching• Backing up views• If we have time: Theming Views - quick look!6Wednesday, May 15, 2013
  7. 7. What you need to know already!• How to add content• How to customize content types (add fields)• What modules are• How to install and configure modules• From last week: How Views works, how to add a newView7Wednesday, May 15, 2013
  8. 8. FINISHING YOURVIEWSFinal checks8Wednesday, May 15, 2013
  9. 9. Final checks9Wednesday, May 15, 2013
  10. 10. Don’t forget! 123465710Wednesday, May 15, 2013
  11. 11. Views QAhttp://www.zivtech.com/blog/views-quality-checklist11Wednesday, May 15, 2013
  12. 12. Disable the Views UI• Finished? Disable the Views UI module.•12Wednesday, May 15, 2013
  13. 13. Tip!• Enabled modules eat your memory. If it’s notin use- Disable it!• If you’re never going to use it again, uninstallit, and remove from file system too!13Wednesday, May 15, 2013
  14. 14. Caching14Wednesday, May 15, 2013
  15. 15. All done?• Enable caching to store query and output.15Wednesday, May 15, 2013
  16. 16. Site caching basics• Set lifetime to minimum 5 minutes.• Will your content editors freak out?https://www.acquia.com/blog/when-and-how-caching-can-save-your-site-part-2-authenticated-users16Wednesday, May 15, 2013
  17. 17. Save your site• Read Hernani’s blog posts!https://www.acquia.com/blog/when-and-how-caching-can-save-your-site-part-2-authenticated-users17Wednesday, May 15, 2013
  18. 18. What to cache• Blocks• Pages• Don’t cache admin views.• User bookmarks - places where peopleexpect immediate response.http://www.millwoodonline.co.uk/blog/drupal-7-performance-gains-with-views-cache18Wednesday, May 15, 2013
  19. 19. Block cache type19Wednesday, May 15, 2013
  20. 20. Block cache20Wednesday, May 15, 2013
  21. 21. Debugging?• Disable caching when debugging21Wednesday, May 15, 2013
  22. 22. Demo• Block and page cache settings underperformance• Views cache options!22Wednesday, May 15, 2013
  23. 23. Smart cache option• Views content cache• http://drupal.org/project/views_content_cache23Wednesday, May 15, 2013
  24. 24. EXPORT TO AMODULEA better way24Wednesday, May 15, 2013
  25. 25. Dangerous• Views configuration is saved in the database.• Editing a view on a live site• Letting someone else edit the view on a livesite.• What if your precious View was ruined :(25Wednesday, May 15, 2013
  26. 26. Quick and dirty: Export26Wednesday, May 15, 2013
  27. 27. Import manually27Wednesday, May 15, 2013
  28. 28. Demo• Export code to a text file.• Easy!28Wednesday, May 15, 2013
  29. 29. Better: Export to module• In code instead of storing them in thedatabase.• Can managed by your version control system- easier to push change from development tostaging to production.• Modest performance improvement due toloading from disk and not database.http://www.deckfifty.com/blog/2012-02/using-drupal-views-codeExample code available at http://j.mp/ZhgWFn 29Wednesday, May 15, 2013
  30. 30. hook_views_default_views()• http://api.drupal.org/api/views/views.api.php/function/hook_views_default_views/7• Allows you to set a default view andconfiguration in code.Example code available at http://j.mp/ZhgWFn 30Wednesday, May 15, 2013
  31. 31. Create a module• Two text files• deliciousdrupal.info• deliciousdrupal.moduleExample code available at http://j.mp/ZhgWFn 31Wednesday, May 15, 2013
  32. 32. Tip: Custom folder• Custom modules?• Add them in a “custom” folder.• /custom• /contrib32Wednesday, May 15, 2013
  33. 33. Info file• deliciousdrupal.infoExample code available at http://j.mp/ZhgWFn 33Wednesday, May 15, 2013
  34. 34. Module file• deliciousdrupal.module• Declare hook_views_api()• You can paste the exported view directly, butthat is messy.34Wednesday, May 15, 2013
  35. 35. Easier to maintain: Includes• Keep the includes in a separate folderExample code available at http://j.mp/ZhgWFn 35Wednesday, May 15, 2013
  36. 36. Example code available at http://j.mp/ZhgWFn 36Wednesday, May 15, 2013
  37. 37. Easier to scale: Each view its own file• Export each view and allow your module toscan for new views.37Wednesday, May 15, 2013
  38. 38. Demo: Backup a new view• Back up a view, adding to the module.• 1. New text file - machine name of view.• 2. Open with• 3. Paste exported code• 4. Save!38Wednesday, May 15, 2013
  39. 39. Enable the moduleExample code available at http://j.mp/ZhgWFn 39Wednesday, May 15, 2013
  40. 40. Backed up!• Before:• After - protected from deletion40Wednesday, May 15, 2013
  41. 41. Clear cache• Views > Settings > Advanced41Wednesday, May 15, 2013
  42. 42. Database overriding code• Indicates that it’s in code and also saved indatabase.• Go to Views list to see your new viewsavailable.• Click “Revert” to delete database copy.42Wednesday, May 15, 2013
  43. 43. Changes?• Working in staging site.• Your colleague “edits” a view and testschanges.• Export and save to your .views include files.• Add new Views the same way:• Export• Add PHP declaration• Save as .view in your includes folder43Wednesday, May 15, 2013
  44. 44. Add a new view?• Back up a view, adding to the module.• 1. New text file - machine name of view.• 2. Open with• 3. Paste exported code• 4. Save!• 5. Clear cache! <-- now that module isalready enabled.44Wednesday, May 15, 2013
  45. 45. Recap• Various states:• “In database” - Not exported to code• “Database overriding code”• “In code” - No changes saved in database• Actions:• “Edit” - Create a copy in database withchanges• “Revert” - Delete from database• “Disable” - Views in code can’t be deleted!45Wednesday, May 15, 2013
  46. 46. Features• This works the same way as Features.• Basic module file• Exported code• This is what Features does for youautomatically.http://drupal.org/project/features46Wednesday, May 15, 2013
  47. 47. THEMING VIEWS47Wednesday, May 15, 2013
  48. 48. What you may expectMock upDesignCompsConfigureand buildsiteDrape overthemeDone!48Wednesday, May 15, 2013
  49. 49. “Markup megalomaniac”Design instatic HTMLand CSSConfigureprototypein corethemeModify TPL tomatch originalmarkupConfigureto modifymarkupBuild styleguide andreusableclassesDone!49Wednesday, May 15, 2013
  50. 50. “Skeleton and skin”Skeleton:Regions andCSS forstructureSkin:CSS for visualdesignDone!Contenttype designConfigureprototypeof siteConfigureto modifymarkup50Wednesday, May 15, 2013
  51. 51. Recap Views UI12543651Wednesday, May 15, 2013
  52. 52. Example• Recent comments View52Wednesday, May 15, 2013
  53. 53. Anatomy of a ViewViewThats great news! 50 min 32 sec agoOh I see, so even if i dont 4 weeks 52 min agoCustom subject heading 4 weeks 53 min agoRowTitle fieldDate field53Wednesday, May 15, 2013
  54. 54. Nested templatesDisplayFormat (style)FieldRowFieldFieldRowField54Wednesday, May 15, 2013
  55. 55. View default output• Depends on Views settings55Wednesday, May 15, 2013
  56. 56. Configure to customize• Modify format• Specify elements• Add classes• Strip markup• Strip default classes• Make some fieldsinline56Wednesday, May 15, 2013
  57. 57. Example57Wednesday, May 15, 2013
  58. 58. Views base templates58Wednesday, May 15, 2013
  59. 59. Example59Wednesday, May 15, 2013
  60. 60. How can I find this?60Wednesday, May 15, 2013
  61. 61. Which is being used?61Wednesday, May 15, 2013
  62. 62. Display and format62Wednesday, May 15, 2013
  63. 63. Template suggestions• All fields (default)• All fields just in blocks• Any subject fields just in blocks• Just subject fields in blocks in recentcomments view63Wednesday, May 15, 2013
  64. 64. OverridingCopy into your theme folder and rename64Wednesday, May 15, 2013
  65. 65. Rescan template files65Wednesday, May 15, 2013
  66. 66. Next up!• Check out the blog for notes from this 3 part class• Drupal essentials- May 22nd: Drupal Essentials: How to Configure Accounts in Drupal• Drupal for Project Managers mini-course- May 29th-June 19th: 4 weeks - Drupal for Project Managers! AdamBoysen, Jakub Suchy, Amye Scavarda, Jenn Sramek66Wednesday, May 15, 2013
  67. 67. Events! Learn in person• http://acquia.com/events• http://training.acquia.com/events• http://dublin2013.drupaldays.org/• http://www.drupical.com/67Wednesday, May 15, 2013
  68. 68. VIEWS NEXT STEPS!Your assignment68Wednesday, May 15, 2013
  69. 69. Your assignment• Last week you made a view, right?• This week:• Add a display with an attachment• Make a contextual filter or use arelationship• Add a link to your menu• Watch tutorials 4 parts, 5 mins each!http://www.drupalgardens.com/content/new-views-tutorials-4-part-intro69Wednesday, May 15, 2013
  70. 70. Views webinar!• Tips and Tricks for Getting the Most Out ofViews [April 30, 2013]• http://j.mp/mostviews• Suzanne Kennedy, Evolving Web - one of ourtraining partners.http://training.acquia.com/events/canada• DrupalCon: Mastering Views Configuration• http://portland2013.drupal.org/node/371870Wednesday, May 15, 2013
  71. 71. Views tutorials• Quick version: 4 parts, 5 minseach!http://www.drupalgardens.com/content/new-views-tutorials-4-part-intro• Drupalize.mehttp://drupalize.me/videos/overview-views• 10 part series with “TorontoWeb Developer”http://j.mp/Zc8nEO71Wednesday, May 15, 2013
  72. 72. TRAINING!72Wednesday, May 15, 2013
  73. 73. Course materials• Tested in hundreds ofclassrooms.• Continuously updated.• Clear and easy follow, butengaging content.• Blend of guided andchallenge exercises totest skills.http://training.acquia.com/coursesThe materials /handouts were verycomprehensive -personally I would notchange anything.- O.G. Jan 201273Wednesday, May 15, 2013
  74. 74. The trainers are partners• Our trainers areexperienced developerswho love teaching.• They provide subjectmatter expertise as wellas well as passion for thetopic.• Partners are placed allover the globe.http://training.acquia.com/testimonialsLovely presenter, verypatient and open toquestions. I feel a lotmore confident to usedrupal myself andunderstand thetechnicalunderpinnings.- C.L., Sept 201274Wednesday, May 15, 2013
  75. 75. • Popular packages are typical examples of the tailoredpackages we have delivered.Tailored courses availablehttp://training.acquia.com/eventsTRAINING@ACQUIA.COM75Wednesday, May 15, 2013

×