In this video, you’ll learn how to create a page view.
Transcript
Trainer (00:00):
In the previous video, you learned about what the Views module does. And we also looked at the Views interface. Now, it’s time to build an actual View. And what we are going to do right now is we’ll create a View called Latest Articles. And this View will display published articles. It’ll also sort the articles by the created date. So the most recent articles are up the top and it’ll display the following fields. So if we go to content and edit one of the articles, it’ll display the title, a trimmed version of the body, the tags field, and also the image. And we’ll also display the created date. So to create the View, go to structure, Views, and then click on add View. And in View name, add in Latest Articles. And from View settings, click on show and make sure content is selected. But here, you can see all of the content that you can query using Views.
Trainer (01:05):
So you could create a View to show comments, custom blocks, files, taxonomy terms, and even users. But in our case, we want to query the article content type, which is content. So make sure content is selected from of type. Leave it set to all, and then change sorted by to unsorted. Then in the page setting section, click on create page and you’ll straight away notice that the page title and path are automatically populated using the View name, but you can change the title or the path if you like. And if we scroll further down, we can change the number of items that will be displayed. And also, if a pager should be used. The only change we’ll make here is instead of Views rendering the teaser view mode of the article, we’ll change it to fields. And another thing I should mention is that these options can be changed later on. So once you’ve configured everything, scroll down and click on save and edit.