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 Sramek
4Wednesday, May 15, 2013
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. 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 new
View
7Wednesday, May 15, 2013
12. Disable the Views UI
• Finished? Disable the Views UI module.
•
12Wednesday, May 15, 2013
13. Tip!
• Enabled modules eat your memory. If it’s not
in use- Disable it!
• If you’re never going to use it again, uninstall
it, and remove from file system too!
13Wednesday, May 15, 2013
15. All done?
• Enable caching to store query and output.
15Wednesday, May 15, 2013
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-users
16Wednesday, May 15, 2013
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-users
17Wednesday, May 15, 2013
18. What to cache
• Blocks
• Pages
• Don’t cache admin views.
• User bookmarks - places where people
expect immediate response.
http://www.millwoodonline.co.uk/blog/drupal-7-performance-
gains-with-views-cache
18Wednesday, May 15, 2013
25. Dangerous
• Views configuration is saved in the database.
• Editing a view on a live site
• Letting someone else edit the view on a live
site.
• What if your precious View was ruined :(
25Wednesday, May 15, 2013
29. Better: Export to module
• In code instead of storing them in the
database.
• Can managed by your version control system
- easier to push change from development to
staging to production.
• Modest performance improvement due to
loading from disk and not database.
http://www.deckfifty.com/blog/2012-02/using-drupal-views-code
Example code available at http://j.mp/ZhgWFn
29Wednesday, May 15, 2013
31. Create a module
• Two text files
• deliciousdrupal.info
• deliciousdrupal.module
Example code available at http://j.mp/ZhgWFn
31Wednesday, May 15, 2013
32. Tip: Custom folder
• Custom modules?
• Add them in a “custom” folder.
• /custom
• /contrib
32Wednesday, May 15, 2013
34. Module file
• deliciousdrupal.module
• Declare hook_views_api()
• You can paste the exported view directly, but
that is messy.
34Wednesday, May 15, 2013
35. Easier to maintain: Includes
• Keep the includes in a separate folder
Example code available at http://j.mp/ZhgWFn
35Wednesday, May 15, 2013
37. Easier to scale: Each view its own file
• Export each view and allow your module to
scan for new views.
37Wednesday, May 15, 2013
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
42. Database overriding code
• Indicates that it’s in code and also saved in
database.
• Go to Views list to see your new views
available.
• Click “Revert” to delete database copy.
42Wednesday, May 15, 2013
43. Changes?
• Working in staging site.
• Your colleague “edits” a view and tests
changes.
• Export and save to your .views include files.
• Add new Views the same way:
• Export
• Add PHP declaration
• Save as .view in your includes folder
43Wednesday, May 15, 2013
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 is
already enabled.
44Wednesday, May 15, 2013
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 with
changes
• “Revert” - Delete from database
• “Disable” - Views in code can’t be deleted!
45Wednesday, May 15, 2013
46. Features
• This works the same way as Features.
• Basic module file
• Exported code
• This is what Features does for you
automatically.
http://drupal.org/project/features
46Wednesday, May 15, 2013
48. What you may expect
Mock up
Design
Comps
Configure
and build
site
Drape over
theme
Done!
48Wednesday, May 15, 2013
49. “Markup megalomaniac”
Design in
static HTML
and CSS
Configure
prototype
in core
theme
Modify TPL to
match original
markup
Configure
to modify
markup
Build style
guide and
reusable
classes
Done!
49Wednesday, May 15, 2013
50. “Skeleton and skin”
Skeleton:
Regions and
CSS for
structure
Skin:
CSS for visual
design
Done!
Content
type design
Configure
prototype
of site
Configure
to modify
markup
50Wednesday, May 15, 2013
53. Anatomy of a View
View
That's great news! 50 min 32 sec ago
Oh I see, so even if i don't 4 weeks 52 min ago
Custom subject heading 4 weeks 53 min ago
Row
Title field
Date field
53Wednesday, May 15, 2013
56. Configure to customize
• Modify format
• Specify elements
• Add classes
• Strip markup
• Strip default classes
• Make some fields
inline
56Wednesday, May 15, 2013
63. Template suggestions
• All fields (default)
• All fields just in blocks
• Any subject fields just in blocks
• Just subject fields in blocks in recent
comments view
63Wednesday, May 15, 2013
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! Adam
Boysen, Jakub Suchy, Amye Scavarda, Jenn Sramek
66Wednesday, May 15, 2013
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
69. Your assignment
• Last week you made a view, right?
• This week:
• Add a display with an attachment
• Make a contextual filter or use a
relationship
• Add a link to your menu
• Watch tutorials 4 parts, 5 mins each!
http://www.drupalgardens.com/content/new-
views-tutorials-4-part-intro
69Wednesday, May 15, 2013
70. Views webinar!
• Tips and Tricks for Getting the Most Out of
Views [April 30, 2013]
• http://j.mp/mostviews
• Suzanne Kennedy, Evolving Web - one of our
training partners.
http://training.acquia.com/events/canada
• DrupalCon: Mastering Views Configuration
• http://portland2013.drupal.org/node/3718
70Wednesday, May 15, 2013
71. Views tutorials
• Quick version: 4 parts, 5 mins
each!
http://
www.drupalgardens.com/
content/new-views-tutorials-4-
part-intro
• Drupalize.me
http://drupalize.me/videos/
overview-views
• 10 part series with “Toronto
Web Developer”
http://j.mp/Zc8nEO
71Wednesday, May 15, 2013
73. Course materials
• Tested in hundreds of
classrooms.
• Continuously updated.
• Clear and easy follow, but
engaging content.
• Blend of guided and
challenge exercises to
test skills.
http://training.acquia.com/courses
The materials /
handouts were very
comprehensive -
personally I would not
change anything.
- O.G. Jan 2012
73Wednesday, May 15, 2013
74. The trainers are partners
• Our trainers are
experienced developers
who love teaching.
• They provide subject
matter expertise as well
as well as passion for the
topic.
• Partners are placed all
over the globe.
http://training.acquia.com/testimonials
Lovely presenter, very
patient and open to
questions. I feel a lot
more confident to use
drupal myself and
understand the
technical
underpinnings.
- C.L., Sept 2012
74Wednesday, May 15, 2013
75. • Popular packages are typical examples of the tailored
packages we have delivered.
Tailored courses available
http://training.acquia.com/events
TRAINING@ACQUIA.COM
75Wednesday, May 15, 2013