Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
There's one part of the Views interface that we've skipped over until now. Although there's a good chance you've noticed that at least once. That's the built-in views that you see when you first go to the Views administration page as you see here. Some of those built-in views are designed to replace existing Drupal pages, such as the Home page. Others are just cool. But all of them are instructive. So let's take a look at a few of them. The first one that we'll look at is actually the simplest. It's called Front page and it emulates the front page that Drupal comes with by default. Let's scroll down and find it. To turn it on, click the Enable button. You'll notice that one thing it does is to create a page, which is that Front page.
Let's go there and compare it to the actual front page of the Drupal site. You'll see that it looks very much like the Front page. If we bring up the Front page in another browser window and go back and forth between the two, there's virtually no difference at all, except, of course, you can edit the view by going up to your little ghost menu here. Let's take a look at how that's done. You'll see that it filters only to publish nodes as well as those have been promoted to the Front page. Of course, that's the way that Drupal figures out what to put on its default front page.
Let's just save that and go back to our list. Click on Edit and List. Now that we've turned it on, you'll notice there's something different between that Front page and People view. You can edit them, you can export them and you can clone them, but whereas you can delete the People view, you can only revert the Front page view and once you've reverted it, you can then disable it. That's because you can't actually delete these built-in pages. Let's scroll down in this list of views. We have the one that we created here, we also have this one, archive, and after it you see in parentheses 'default.' That's because it was installed by default when you installed Views. As you scroll down further, you see one that has Date in parentheses. That was one that was installed by a module, the date module, which we installed earlier on in this course.
But let's get back to the learning part. One thing in common with all of these views, except for the Front page one we just looked at and one other, is that they use a Views property called Arguments. Arguments is a fairly difficult subject to explain. I struggled with it for a long time, until I just took a look at some of the built-in views that used them and then it all became clear. I'll show you what I mean. We'll do so by enabling the archive view and then editing it. The first thing that you'll notice is the archive view has a page and a block. Let's take a look at that page and we see that it has a path of archive. I'm going to save that and then go to that page. What we see here is a list of months and years followed by a number in parentheses.
Let's click on that and find out exactly what it means. If you've posted nodes over a period of months, it becomes immediately clear. It's a list of what nodes were posted in what month. That's very useful, for example, for a blog site. But just as importantly, look at what happened up here in the URL. We see the year followed by the two- digit month. Now, if we go back to our view by clicking on Edit, we can start to understand exactly how arguments work. Let's go again and take a look at that page. Since we have all of our nodes entered only in March, we're only going to see one page of archives. What if we entered a 4 up here? Ah! We see exactly how it works. Just as we expected, we see April and if we created content, let's try creating a node. We'll just create a person and we'll call them testy mctestalot.
We don't need the rest of the information. We'll just scroll to the bottom and change the Authoring information. So, it looks like it was authored in April, 2009-04-01, scroll down and Save. Now, let's go back to our archive and we see, we have that one post. So it works exactly the way we expected and furthermore, if we go in and edit that view, we can figure out how arguments work a little better. Just to clean things up, I'm going to delete that node by going to Administer > Content management > Content, select the node, choose Delete and Update.
And yes, we do want to delete it. Finally, we'll go back to our view, by Administer > Site building and Views. Built-in views are great for learning because no matter what you do, you can always hit Revert. To actually save the view permanently, of course, your best bet is to clone it. The resulting cloned view would be just like any other view you created from scratch and you'd be able to delete it later if you want it. For help with cloning, see the video about importing, exporting and cloning views. One last thing. You might be wondering what good it would be to have a view called Front page if you always have to go to that URL, Front page, that is not actually the front page? Well, you can turn any view into the front page very easily. In fact, I'd like to do that with our People view.
To do so, go to Administer > Site configuration, then scroll down to Site information. If you scroll to the bottom of this page, you see Default front page. Right now, it's set to node, which is a sort of internal Drupal page. We're going to change that to our URL, people, which is where we have the view stored. We'll click Save configuration. Now, when we go home, instead of seeing that list of nodes, we see our table. In this video, I focused on how much you can learn from built-in views.
But of course, their utility goes way beyond that. Some of them are quite useful right out of the box, while others take a while to modify, so they become a great starting point for your own views. But for those of you like me, who learn best by doing, the education you get from studying built-in views is very valuable.
Get unlimited access to all courses for just $25/month.Become a member
58 Video lessons · 60088 Viewers
61 Video lessons · 92734 Viewers
82 Video lessons · 104195 Viewers
56 Video lessons · 107192 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.