Home / Views Mini-Course, Part I: An Introduction to Views [May 1, 2013]

Views Mini-Course, Part I: An Introduction to Views [May 1, 2013]

Views Mini-Course, Part I: An Introduction to Views [May 1, 2013]

Want to learn more about Acquia’s products, services, and happenings in the Drupal Community? Visit our site: http://bit.ly/yLaHO5.

Even if you're brand new to Drupal, find out what the Views module can do. Heather James, manager of training here at Acquia, will show you around the interface so you can become familiar with key terminology for Views such as displays, formats, filters. She’ll also demo how to create a view of content, users or taxonomy. She’ll give you a peek at how to extend Views with other modules.

You will learn about:
• Views orientation
• Views displays: Block, page, RSS
• Views attachments
• Formats: HTML list, tables, unstructured lists, etc.
• Filters: To narrow down the set of results

Category: 
Publish on date: 
Thursday, May 2, 2013
Rating: 
Click to see video transcript

Moderator: Views Mini-Course Part 1 – An Introduction to Views with Heather James who is the manager of training here at Acquia. We are very excited to have Heather on the line.

Heather James: …the training program at Acquia was established in 2010 and just last year, we trained over 3,000 people, so we get a lot of people in the door who are brand new to Drupal. We maintain our own course materials so they’re continuously updated, and that keeps us pretty busy.

The training is actually run by our training partners and those folks are experienced developers and they actually enjoy getting away from behind the computer and helping other people, so you’d actually find the events are quite fun and you get a lot of insight into real-life kind of Drupal problems and solutions.

We have a lot of tailored courses available and I’m happy to talk with you at any time about setting up training for your team, so please contact me if you need some advice.

So you’ve landed on the very first class which is our first mini course, which is an introduction to Views, and we will have soon a Drupal for Project Managers mini-course that will be a four-part course coming in May. We put these together because we thought that there were still lots of people who – and even though there are a lot of free stuff out there, we wanted to contribute and make some more training available for you guys.

In this mini-course, you’re going to find out in these three weeks how to expose data across your site, create lists of content, users, and terms; and format it as tables, lists, galleries, slideshows; and that’s really what Views does. Today, we’re just going to start with the very basics. We’re going to start with just how Views works and what it does, and give you a general orientation and terminology of just so you’d kind of know enough basically to be dangerous, at least in the next week.

In order to get most out of today’s session, you’ll need to already understand how to add content to Drupal, how to customize content types, what modules are, and how to install and configure modules.

You might find yourself somewhere on this spectrum. I actually was sort of surprised that you might find people like this little orange dot here, someone who has actually got some experience with Drupal but really doesn’t know what Views is or is aware of Views but hasn’t actually felt them or made any use of them. I expected everyone to be like this blue dot. If you know Views and you’re experienced with Drupal, you probably know a lot about Views, but what I was surprised to find is on a lot of client sites where they’re building websites and not making any use of Views at all, and that’s why I wanted to run this mini-course.

We’re going to dig in now and first thing we’re going to do is address a kind of misconception, we could say. We’re really I guess brainwashed by this metaphor of manila folders and files and manila folders, and we sort of still think that way to the point when you’re even developing your own website, you may be thinking, “I’ve got a mental sitemap with pages and they fit in folders.” In fact, some or many actually - CMSs actually work this way so you may be familiar with other CMSs where you’d want to add a section on your site, so you add a folder and then you add in pages within that folder.

The problem is this isn’t just a mental hurdle. It also causes logistical problems if your CMS does work that way. Say for example, you want to add news headlines showing up in the sidebar of your contact page, so you’d have to what – maybe every time a news item was added, you’d have to copy the text, put a link, and update the contact page or update it all across the site wherever it appeared. Believe it or not, there’s a lot of people still even using Drupal that way and you don’t have to.

What we’re going to do right now is think of Drupal as holding data so not everything you’re going to see on our Drupal site is content per se but everything is data. Views is going to help us expose those data across the site, so you can think of these in different groups.

Now, I just thought it would be good if we got our hands dirty first of all. I’m going to do a very quick demo and kind of a magic trick and just show you how Views works. I promise I will go into it in much more detail afterwards.

The first thing we’re going to do is look at what Drupal does out of the box for listing content, and then we’ll see how we’re going to override that and we’ll see how to make a new view listing content type.

I’m going to bring you over to my Delicious Drupal site here. Here, I’m logged in as the User 1 or the Administrator so I see all the various controls available. Here’s a list of content on the site. We call this like the “river of content” which is okay. If I go over to Site Configuration, Site Information, I can see that I could change the amount of posts on the front page and I could even change the path, but that’s pretty much all I can do. The only other option I have is to go to Structure, Content Types. Say for example, with a specific content type like the fan art or cooking website, we don’t want recipes to show up on the front page. So I could change the default option that it doesn’t show up on the front page, and so I could limit that by all the various content types but still it’s quite limited in what I can do.

What I’d like to do on my Delicious Drupal Site is have a list of news items or news articles, so I’ll show you how to do that. Go to Structure, Views; of course, with the Views module enabled already. So we’ll go to Structure, Views, Add new view, and I would call it News Articles. Show in Content, so I mentioned before, we’ve got lots of different data here. We’re going to select Content in this case; of type, Article, so I’m limiting how much I’m going to show. I will create a page, here we go. I can even customize this path to make it shorter or change it any way I like. I’m going to keep the Default options. This is where you can see you can change your formatting and to keep it as Teasers, and that’s pretty much very similar to what’s on the front page and I can change the number of items to display.

I’m just going to save the options as we set them up in that wizard there, Save & Exit, and here we see a news page. Okay, fantastic. We’ve only got news articles now. We’re not getting everything else but if I go back to my home page, of course, it’s not set to my home page yet so I have to go back to Site Information and make my Default front page the news path that I just created.

Now, this is a little bit of magic hand-waving I’m doing right now. I am going through this a little bit quickly. I’m going to ask Hannah. If anyone has questions, Hannah can message me on Jabber and I’ll be able to see her questions if I’m going too quickly. I just want you to know that I will be covering this in more detail.

Here we go. We’ve created a view and it has got just the news. So hopefully at this stage now, what you know is that Views can allow you to basically limit your display of content. Let me go back to the presentation now. Now, there’s a potentially confusing problem. You may have realized that when we’re displaying content, we chose Teasers. Those are called View mode in Drupal and that has really nothing to do with Views, so another option which I’ll show you soon is to select Fields and then you can get field specific control.

At least at this stage, if what you understand so far about Views is that it’s a query builder, then we’re goaled in. We’re right where we need to be. We’re going to take a step back now and let me give you a little understanding of why we really have Views.

I love this website here. This is the Jane Pickens Theatre site. When we look at the front page – or the Coming Attractions Page, I should say – we may think, “Oh, okay. Well, we’re looking at a page of all of the content on this site and maybe this page is a piece of content where I can go in and edit the title of that coming attraction.” In terms of what Drupal thinks about this content, it’s only this piece here so we’re looking at one item of content or actually it’s called a node in Drupal, and that excludes anything in the sidebar, the header, the footer. This is just one entry in the content table as one piece of content. When we see something like a landing page like this, what you’re actually seeing is a collection of lots of different content from across the site. In the middle here, we see a slideshow so it’s just showing us things which have somehow been marked Featured, and then we’re seeing at the bottom, Coming Attractions like a gallery of movie posters and music posters.

This may be very different from how you’re thinking of how you approach developing your own sites if you’re new to Drupal. Now, perhaps your process and your workflow starts at Fireworks and you make your perfect markup and then you go to make your perfect markup and you got everything working just fine. Maybe in the old days, when you were doing database connections and combining HTML with your query results, you had to write this kind of messy code yourself. Things have gotten a bit better. We’ve got some great CMSs out there.

Here’s an example of ExpressionEngine which is like a tag-based templating system that has a query that we can actually alter and change. For example, say give us some information about the users. My question is what happens in the case that a client wants to change some of the logic or change what gets listed? They’re going to have to be calling you, right? I think it’s fine definitely if your business is keeping people’s websites updated and changing them, then you’re happy but if you work with a larger team of people, you may find that Views is going to be much easier to work with that will allow your colleagues to go and change the queries and update things or even create their own Views.

In fact, Views itself was actually developed at Sony by Earl Miles or merlinofchaos, and it has become so popular in fact that it has been included in Drupal 8. I don’t know if you can see the text here is quite small but one of the things that was found in Drupal 8 is that basic default front page was replaced with Views, so even that activity that I just showed you, replacing your front page with Views, is already included in Drupal 8.

So let’s say you’re brand new to Drupal and this happens a lot in a situation where you might want to create events. You probably would go directly to Drupal.org and you might be looking, for example, for a module that will allow you to have easy date selection, sidebar block showing like a little calendar or something like that, and you look for the event module. In Drupal 5 or 6, that’s exactly what you would’ve found but now with Drupal 7, we’re sort of pushing over into more generic and flexible solutions. So it’s actually a funny thing because you’ll actually be using less modules altogether. You have to use more modules to get the event – obviously, you use more modules to get this event functionality but once you have Views installed and the date modules, you can use them in lots of different ways.

You have a lot more control as well so instead of in the event module if you want to change, for example, how the data entry was, you have to write custom code yourself whereas with the date modules, you can create a field and control how the input is – if ever received I guess you could say. You can also have options for formatting how it displays so with Views, for example, you have the option of display formats or templates that create these calendars, the Full Calendar or the Calendar module. I hope that gives you a sense of really want makes Drupal a little bit different. I like to call this the “big fancy middle man” where Drupal allows you to control and configure display and layout. It makes it very different from other systems as you saw with ExpressionEngine or maybe WordPress.

At Acquia, we really believe that you’re going to get a better quality site that’s easier to maintain through more configuration, more site building, and less custom code. In fact, this just results from a survey done in 2011 of Drupal agency executives and they said that’s pretty much what they were looking at. It’s about 80% of their development project was done with site building and configuration and overall, that has less security risks, it’s easier to maintain, and I think you’re going to find it much easier to manage.

At this point, as long as you understand I guess that the CMS supposedly makes it easy, obviously, for a lay person to update content on the site without a developer, it’s Drupal taking it one step further and putting those developer tools within the reach of other people on your team. In fact, with the training we provide, we often find it’s a matter of change management because people have to change even the way they communicate within their development team so you may find that someone else in your team who is involved in user experience is able to now create a view and get involved in actually creating workable prototypes of your site.

We’re going to take a second to find your way around the Views. I just wanted to ask really quick - did anyone have any questions so far? I’m going to see. This is my first time actually doing the webinar so I’m sorry about any problems I’m having.

Moderator: We have one question come in. Will you be explaining one of the Views you’ve used versus one that’s not?

Heather James: That’s a really good question. Yes, definitely. I think that in general, you want to be using Views especially for listing content on your site. I’m sorry, I’m just getting a little dazzled by the interface here on WebEx. If you’re going to be listing content on your site or making any lists of any data on your site, you want to be using Views basically. There are situations where if you have a site with a large volume of content or large volume of comments, for example, you will probably want to export your queries and optimize them and make them a little bit more fine-tuned but other than that, Views would begin, would start as a really great prototyping tool, for example, so I hope that makes sense.

Moderator: We have one more come in.

Heather James: Sure.

Moderator: Everyone has events. Does everyone have to build event content types or views? Is there a best practice?

Heather James: Yes. Actually, I did an events webinar a few months ago and because something like events we’ve done so frequently, there are people sharing modules that extend what Views can do. For example, write your calendar display, there are some great modules that help you get control over that. In terms of events management though, it’s actually sometimes you may be wanting to handle commerce, so you might start with something like Drupal Commerce to handle the payment or registration, or you might be using another service such as Eventbrite which handles your registration externally, and there are modules for that as well. I hate to say it depends but let’s see. I think it does actually. I hope that helps. We can get you the link to the – or you can look on our site for the events webinar which I think could give you a sense of how to configure your own event content type.

I am going to dig right into the Views UI and help you find your way around. I did a little magic trick before and we used the Views Wizard. The Views Wizard shows up when you first create a view and it has got some very basic functionality available but like any good wizard, I want you to know that it does disappear and that’s extremely confusing for someone who’s new to Views. I’ve had this time and again. People go back to edit the view and they expect to be able to get back to this wizard. It won’t happen.

What you will see the next time you edit your view or continue on to Save & Edit view is the regular Views editor interface. Admittedly, there are a lot of options here so it can be a little dizzying, but we’re going to simplify the whole interface. If we just think about two questions, we’re first of all going to limit what we’re displaying so you’re going to focus on the sections of what you select and filter. Next, you’ll be thinking about how to format and display that so there’s a few sections I’m going to talk to you about to show you how you can get control over what it looks like.

Next week for the second session, we’re going to go into all of these in a lot more detail but just for right now, I just want to give you an overview. The first thing you’re doing is you saw me do when I created that articles list is you’re choosing your base table. If you already understand how databases work, you probably have a sense of, “Okay. I’m actually going to run a query on a specific set of data in my database.” Once you do that, you cannot change it later.

You can, however, use relationships to get data from another table and if this sounds like gobbledygook, I’ll give you an example. You may have a list of content and then you want to also show the author or maybe something about the author, maybe a picture or something like that. You can use relationship to get more information about some related data.

The next thing you’re going to do is somehow to filter a limit, so you don’t want to just cripple your site by listing all the content and everything. You’re going to either like limit by which author you have or maybe you want to limit by a specific content type. After you do that, you’re going to somehow select – you can select the View mode as I showed you before with like the teaser or you can select Fields. You’ll probably most likely be selecting Fields and you can even change and arrange how they layout.

The next thing you’ll do is select a format. So you’ve seen a lot of different formatting options here. You’ll notice I put in a map. That would actually be done with another module that will plot your coordinates, for example, on a map. There are some great tools. There’s not just these. There are slide shows and there’s a lot of great other modules you can try out and we’ll be talking about those as well next week.

I’d like to point out as well, you can configure the formatting that is output. Let’s say you have a field like the title. You can change what header that will be output as. You can even rewrite the output. You get a lot of control I think that people miss when they’re creating their Views. In this example, it’s probably hard for you to see on the small screen but you’ll see you can add a level field then exclude it from display, and it becomes then a token. On the right, what I’m showing you is that you can add it as a CSS class. It just gives you a lot more flexibility of how you rewrite the output of your view.

You then choose the type of display. You probably do this in an earlier step but it makes sense at this point to think of you can either output page displays or block displays. There are RSS feeds. There are a lot of other displays that become available as well when you add contributed modules.

Just to give you a sense of like the output, for example, let’s say I created this table of recipes. If you can see I’m inspecting the code there, you can see that the level or intermediate, for example, became a class on that table data cell, so that will give you some ability in CSS. I can make that color a specific color or something like that.

So just to recap, we’re going to choose what to query. We’re going to limit the selection. We’re going to select what we’re going to display, whether it’s Fields or View modes. Then we’re going to configure the formatting and then we’ll choose the displays. Let’s go and do that. We’re going to do another demo. This is the second demo. Hopefully, everything works out.

We’ll be adding a block display to our news list. We’ll choose some fields. We’ll put it in the sidebar, and then we’ll change the fields and change the display and see how it works. So let’s get right to it.

Here I am in my news article view here. A handy way to get to edit the view is to go here on the little gear on a contextual link. I would like to add a sidebar block so I’m going to add a display. Now, I’ve got a block. Well, I’m going to give this display a name because I could end up with a lot of - News article list, I can put it that way, and then to put a lot of displays possibly. Probably for best practice, I should go here and rename this one – Front page news teasers. Do whatever, you could put some information like that, for example.

Here, we’re going to edit this block, News article list, and I’m going to change the format. I’m going to get a preview, first of all, like I don’t want all of this content showing up in my sidebar. That would not look good. I’m going to change the format from content. Oh, sorry. For selecting what’s displaying, we’ve already selected what we’re displaying just to point out that we’re already displaying the content type article. We’ve got something we’ve already selected.

So we’re going to change from Content to Fields, apply it in there and it should throw up an error. Fantastic. Oh, it should throw up an error anyway. It automatically added the field title. Oh, that’s fantastic. Okay. We’re going to add now I think a date will be good for the news list. Add a field, add a date, Content: Date, okay. I won’t need a label. You can change the format so just like a nice short date, Apply, and here we can see it’s not displaying. Fantastic. I love doing live demos and not realizing what I’m doing. Yes, I actually picked my date fields. This is good. Actually, it’s great to learn while someone else makes an error. I picked the wrong date. I picked the date field instead of the date the content was posted. That’s important. You could also choose by Updated date if you chose news, for example.

Let’s see if that worked. I’ll deselect Create a label and choose Short Format. I hope you’re all enjoying my live demo [laughter]. What an opportunity for comedy. So here we get the title and the date, so that’s okay. It’s coming along all right, but I’m going to go and change the format now because I’d like these to show up in a bulleted list. I’m going to change from an unformatted list to an HTML list and just see how this goes. Here we go, fantastic. We’re getting a bulleted list now that looks a little bit better. However, what I’d like to do is have the fields – I’d like to have the fields sort of running next to each other. I want them to show up in line, so go to the Fields Setting and select these fields to be in line. All right, so that’s a lot more – well, it’s a bit more close to what I was planning on doing.

I don’t want a pager at all on my news item. Excuse me, I don’t want a pager on my block. That’s just not going to look right, so I’m going to change it to - for This block, I will say Items to display, display 5, Offset, and – oh, sorry. Use pager. I’ll just click here, just Display a specified number of items. Yes. Items to display 5, sorry. So here we go, a list of news items with the date. It’s getting a little bit closer. I can already see I’ve made the error I was going to try not to make. Let’s see what happens. I added the block and I changed the options there. What I also overrode what happened on my front page, so it ended up that when I added the display, you’ll notice here I’m going to go Show Fields for example. I changed it for All displays instead of This page (override). That ended up overriding my default, so I have to go back and undo everything I’ve just done.

Let me go back to Fields, change to Content, and change to Teaser, Apply (all displays). That looks a little bit better and if I go back to my block, it should look… I hope you guys thought that was funny. Sorry, This block (override). Okay, get our Inline Fields.

All right, so here we go. We’ve got the front page news. Hopefully you can see it’s okay, and we’ve got the teaser showing up and then in my block, I get the News article list and we’re seeing just the bulleted list. Okay.

So now that I’ve created this block display, it will be available to me in Structure, Blocks, and it will show up down towards the bottom, hopefully the list, and we see the View News articles: News article list and I’ll pop it into the sidebar. Put it over here, it shows at the top. Okay, so that should show up in my sidebar second here, above my search form, back home and voila! I’m getting my title and my date.

At this stage, you should understand we’ve got displays. We’ve got the news display and we have the block display showing up, and you also saw what happened when I wasn’t careful enough that you end up actually overriding your displays. So I suppose you can’t put too fine a point on it. You just have to be careful when you’re selecting specific displays in the editing options. It’s something that generally tricks people up in the early stages, and as well best practices to name your displays and that helps you keep track. As you see, when you saw the block listing, that’s the spot what I was looking for.

Let’s recap what we’ve done. First, we selected and filtered with the news articles. We selected specific fields; in that case, we chose a title and a date. Then we change the format so we changed it to be a list. You saw me go back and forth between a list or the view mode, a teaser, and then we chose a display. We had pages and blocks.

Now, that you’ve seen the two demos, so where do you find yourself now? Do you feel like you know a little bit more what Views is? You’re on the – has your yellow or your orange dot sort of moved up a little bit? I’d like to hear what questions people have at this stage.

Moderator: We had one question come in that says, “I’m sorry if I missed this but are we able to add RSS feeds?”

Heather James: Yes, that’s a good question. Let’s look at how to do that. I’m going to go back to my environment here and let’s say, for example, I’ve got my news articles. What we’d like to do is especially on the front page, we’d like to customize it so the front page RSS feed only shows news items. Go back and edit. Before I make the change, you might be already thinking how could I add a list of RSS items to a view? So based on what you know so far, you get the idea that you can add displays. Right across the top here, we’ll click Add a display as a Feed. The Feed options are a little bit different so we don’t have the options, for example, to utilize Fields. It’s a little bit limited, but it’s just automatically formats your RSS feed as you need.

Let’s set a path here, so we’re going to say news stories. We’ll get an output and this is going to give me a preview what the RSS feed will look like generally. There we go, cool, so that’s our display. Does that explain it or no, maybe not yet because I haven’t saved it? Yes. Click Save. The Save button is at the top in Views as well so hopefully you won’t have any problems with that. I’ve actually seen plenty of times where people are working away on their view happily and then they’ll end up not saving what they’ve done. A sad day then. I should see a news – ah, fantastic. I actually will create this as an attachment, in fact. Maybe this would look better.

Another display we can do is an attachment. I’m going to just change one thing on the front page, Front page news first of all. It’s to actually change from five items to like two items, first of all, so we’re only getting two news items up at the top. The last display I’ll add is this front page sub-list, old news we’ll call it.

In the Front page old news, I’m going to change it so we have – I’ll show you the front page now. We’ll see the – what we’re going to do is have two news items and at the bottom, we’ll have like a bulleted list. Maybe I should show you guys something. Okay. I could close either views. So we’ll show you a list of This attachment, change it to HTML list. Instead of Content, we’ll change to Fields and let’s just show the title and save. I’ll remove the updated date from this list. So here’s a list of the other news items and instead of displaying 10 items, we’ll offset to three so we won’t display. There’s just three items that we’re only getting, a few of the options here. We’ll position this attachment After and attach it to the Front page news.

This is the last display to show you. I guess I was going to save this till next week but we didn’t have a lot, so I guess this went a lot quicker than I thought. Let’s look at after you save this, how it appears on the front page. So we see the news articles and there are two items showing up at the top and then the remaining news articles. It would show 10 if I had more news articles on this demo site, but that’s really the last type of display that’s available by default in Views.

Are there any other questions?

Moderator: Yes. We had a couple more come in. What theme are you using?

Heather James: This is just regular old Bartik. This is the default theme that comes with Drupal 7 and I’ve only just changed the logo. Awesome.

Moderator: Okay. The next question is how do you add a lightbox from each image that a view returns so a larger size image can be viewed in a pop-up window?

Heather James: A really good module for that is Shadowbox. I recommend it because it actually provides you – that’s a really good question. I’ll be able to show you next week so I’ll be showing you modules that extend what we usually do. What this allows you to do is it provides you a different display mode so you may think of – let’s say for news articles, for example, let’s go back to our Front page news and I’m going to mess around with this a little bit more just really quick. I’m going to change the Content to Fields for This page. I won’t make the same mistake twice, of course, and apply to this display. We’ve got title and an updated date. We’re going to add an image which is appearing in my node article there. You’ll see here we’ve got a Formatter, Image formatter and we’ve got the Image style, Medium, for example, and link to Content or File.

What Shadowbox will actually give you is another formatter option. There’s a number of modules that do something quite similar, but it will basically give you a formatter so it will have a display in a modal window. A lot of times these contributed modules are just extending what Views can do because it doesn’t have to do everything. It’s just things are offered from network to Views. I hope that’s clear.

Just see here, this is where we’ve done enough so far with messing around with the front page. Page display, this looks kind of horrible. So apply this, just change into an Unformatted list here and just to prove the point, I sort of showed you before you can change the style settings, even rewrite the output, for example. I’m going to change this to like heading three, for example. The image – oh, remove label. I’m just going to be demo-ing away here. I have a few more notes to add to the very end of this presentation here but if you have questions, feel free to ask.

What we’ve done so far, I guess, is you’ve got my idea that with Views, you get a lot of control over what you can display and how it displays. Oh, it’s fantastic. I’m so impressed that I keep on forgetting to do this. I meant to make the first time I did this, I didn’t mean to make a mistake. I thought I was being clever but yes, I’ve got time for questions. Sure.

Moderator: Okay, great. The next question is can you explain the difference between Views and blocks?

Heather James: Absolutely. What you see with Views is that you can create blocks so I’m going to rename this to be News block, for example. I could actually create multiple blocks with Views. I could add another block based on the same query of news articles, for example. Views creates blocks and then blocks are things you place onto the website, so we’ve got Structure, Blocks, and one of the things that has been output – let me just save this. One of the things in output is my News articles, News block. That was actually created by Views. There’s a lot of different blocks just by default. Drupal comes, for example, with a list of recent comments so I’ll just show you that default block. Let me put that up in the Sidebar Second under the Views block there. So blocks can be upped by a lot of different modules and you get some control over where they display. Does that make sense? Views creates blocks.

Moderator: Yes, great. The next question is will you be explaining how to export the queries, optimize them, and re-import them?

Heather James: Yes. Actually, that’s exactly what we’ll be doing in the third part of this. If some of this is a little basic for you, you already know a bit about Views, in the third part of this, we’ll be taking and exporting everything. You’ll be able to see how to export everything you’ve created and save it as a module. Let me just show you. I want to go to Structure, Views. You’ll notice, for example, with this News articles view, I can go ahead and just delete this, which is kind of scary. I can go and edit it and all the changes I’ve made and all that work I did could get lost instantly. What you’d be able to do with the module is have a list of content and I’ll show you one that I actually have, the one I did at a Drupal camp. This one here is not deletable because it’s actually saved in code, so there’s in database overriding code but I can also revert it and it will revert back to what’s saved in my module. So it’s a safe way to back up your Views.

The query that actually gets created is sort of helpful. I think if you want to look at the query itself – sorry, I have to go back to my settings. Go to your Advanced settings here and you can show the SQL query right when you’re looking at it. You can also show some of the performance and how it’s running. Let’s just look at the SQL query for now.

Okay. There you go. Here, you’ll see – if you already are a person who knows how to write database queries, you can get your insight here. Oh, my worst fears have come true. My unprofessional cat has showed up for this webinar. I’m sorry about that.

I’m going to just finish up with some final notes. I know that you guys are giving your time over to this and I just wanted to give you an idea of what I’d like to do over next week. If you’re brand new to Views, I’d like you to go ahead. Based on what you’ve seen so far, create a view yourself so this would be listing of specific content type or maybe all the terms on your site, and create a page display and a block display and then place the block in the sidebar of your site, just the same way we did.

I actually created a tutorial which has just four- or five-minute videos, 20 minutes, so I go through these steps very clearly and you’ll be able to complete that activity. When you show up next week, you can ask me questions more specific to the problems you run into.

If you are a little more advanced as well and you want to learn more, there is a webinar available that was just done yesterday with my training partner, Suzanne Kennedy from Evolving Web, as well as there’s a Mastering Views course actually happening at DrupalCon, so if you’re going to be in Portland, that’s a really great opportunity to get a lot of detailed help with Views.

Then we’ve got some Views tutorials so I mentioned my quick one there. There’s also Drupalize.me that has a great series. It’s not free. There are some free ones there. There’s also a free 10-part series with the Toronto Web Developer, Pete.

That should give you enough help so that by the next time we meet, hopefully you’ll come to the next one on May 8th. We’ll give you a lot more detail on how to build flexible views. Please do sign up for that one as well.

I put up all the notes from this class and all those links. I figured it was probably quite a lot of information. I’ve actually put them up on our blog and so you’ll be able to get access to those tutorials.

Of course, please do come and check out our events. You can meet me at Dublin Drupal Dev Days as well if you want to talk more about Views and configuration. I’m just going to show you that blog post there.

We have about a few more minutes. I think we’re closing soon, but are there any other final questions?

Moderator: Yes. There are a couple more questions that came in. Is there any limitation on the number of blocks we can create in Drupal? Can we create more than 256 blocks?

Heather James: That’s a really good question. You probably – what’s interesting actually about the various displays, you could keep on adding displays to this view and if you think of it, it’s really just variations on the same query. If we’re querying very similar content, it makes sense to just simply add a display. If you’re at the point where you’re adding 250 blocks, you probably have a different need, so I’m going to give you just a hint of how this is done.

Let’s say we had a news page or we have a news article obviously here. Or actually I may have something already created. Let’s look at one I did earlier. I look at the cooking, for example, cooking recipe here. We’re looking at this baking recipe. What we want to show are related recipes and we don’t want to be creating a new view for every single recipe on this site. I’m just going to click on – I’m trying to find one that actually has one. Let me get the baking recipe, or maybe not. Okay. Let me hold on a second. I could get something that’s related based on taxonomy terms. Right. We’ll be showing you this on the next one, but just let me try and do a very quick explanation.

Let’s say you have this recipe here for beginners and you wanted to show in the sidebar other beginner recipes. Well, you wouldn’t want to have to create all of those different blocks for all of those different levels. What you’d actually use are contextual filters, so what it will allow us to do is create a block. For example, we can create a view and I’m just going to quickly see if I can do it and get under the Related levels. Show Content of type Recipes. You don’t want to create a page. We’ll create a block, and we’ll just make HTML list and I’ll Continue & Edit. I will do this in a lot more detail next week, but what we’ll be adding are Contextual Filters. You’d probably do something like this where you will say, “Show me content that’s related by level.” They’ll take the taxonomy term. There’s a lot of magic that goes on here but hopefully it will give you a sense that you could relate content by level. If my demo works out okay, everything will be fine.

The tutorials, by the way, that I’ve linked to you here, there is actually a tutorial specifically on how to do this, so it looks like we’re going to run out of time anyway. Let’s say, for example, we had the setup. Let me see here. I’m going to display this content of title, okay, that’s fine. I’ll save this. Structure, Blocks, and I’m looking for my recipes block I just created, related recipes. Oh, I already had related recipes. Related levels, there we go. Sidebar Second, put it up to the top, and save it.

We’ll go back to our recipes page, show a specific recipe and – sorry. Someone who has done live demos before is laughing at me right now. So we’ve got – oh, that’s not even the related recipe, sorry. I’m sorry [laughter]. I’m looking at the wrong view. Oh, can we cancel this? I’m sorry about the demo. I’ll show you this next week and I’ve actually created a step-by-step instruction about this. Let’s just say if you’re going to create 250 blocks, you probably need to choose Contextual Filters. I hope that was a good enough answer.

The other problem with it is if you are creating views that have a lot of different content, you don’t want to be adding extra displays because you’re just going to be overriding a lot. Once you start adding, say, more displays instead across here, it’s just becoming unwieldy, difficult to maintain and manage. You’re not getting any benefits.

The other thing is if you have a lot of data being pulled into your view, like if you have a lot of different fields and you’re doing relationships and joins, for each one of those displays, all that content gets loaded, so that’s something to consider. You really only want to use multiple displays when a content that’s being selected is quite similar.

I will talk to you next week about caching your queries to make them a lot faster and what effect that has on your site as well. Are there any other questions?

Moderator: Yes. We had a few more. The next question is what is the difference between one view with many displays versus many displays? When do you use a new view versus a display?

Heather James: Yes. I hope that what I’ve just said there sort of explains it. The displays are just to help you create similar lists of content so I actually was going to show you on our upcoming training site, for example. We have a list of European, global, or Canadian, U.S.-only events. If we actually looked at them, we have these individual lists of content. They’re actually quite similar across all the various events. They look exactly the same. They got the same format and the only thing we’re changing is this information that’s coming to the URL here. Those are multiple displays in the same view because the content is very similar and the only thing that’s changing is this variable of the filter criteria of the location. In that sense, we’re getting a benefit from using multiple displays. This just happens in Drupal 6 but I hope that it’s clear from what I said.

Like I said, if you keep on adding multiple displays and you added more data through making a relationship, as you’ll see next week, the pulling in things from another table, all that stuff is loaded for each one of the displays.

Moderator: All right. Thanks so much, Heather. Again, the recording and the slides will be posted at Acquia.com website in the next 48 hours. Heather, do you want to end with anything?

Heather James: Yes. Thanks everyone who showed up. I‘m really sorry that I had a few hiccups myself. It’s my first webinar so I really appreciate you sticking – it’s my first webinar in a long time, I should say, so I appreciate you sticking with it.

I’m going to – hopefully, if you got any questions through the week, we’ll be able to get them answered for you. I’m hoping that you’ll give it a try this week and come in with questions so we can talk about what kind of trouble you ran into as well.

Moderator: Great. Thanks so much.

- End of Recording -