Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Now we come to one of the best parts of Drupal Gardens: views. Put simply, a view is a way to collect a bunch of information on your site into one page. You saw views like pages at the beginning of this course when we clicked on the Blog link up here in the News link. That would show blog post from everybody on your site, or all things that were news items. But you can create your own views that collect nodes according to all kinds of criteria, by using something that's built into Drupal Gardens called simple views. As its name implies, simple views is a streamlined version of a much more complicated Drupal module called Views that's available for core Drupal.
Views is so useful that it is the number one most popular module for Drupal, and in fact, I presented it in entire lynda.com course based heavily on views, called "Drupal 6: Online Presentation of Data." Now, simple views has maybe a tenth of the power of the full Views module, maybe a 50th. But still, it's surprisingly useful. So we're going to create our own view to list all of the tours on our site, with the most recently added ones at the top. In previous videos, we added three nodes at the Tour content type, and you can see that by going to Content and then filtering on the type Tour, and there they are.
Now, it's time to group them. To do that, we go up to Structure and then down to simple views. Now you'll notice one view is already there, as I mentioned--the News view, which is linked from that menu on the front page. We're going to ignore that and add our own view. The title will be called Newest Tours. The path will be new-tours. Now, that describes the page that you'll go to in order to see this information. It'll be your domain/new-tours. We'll display only the tour posts, sorted so that the newest ones are first, and we'll show that simply as a list of titles, where clicking reveals the full post.
We could also limit that to tags so that if, for example, we wanted it to be only the Backpack California tours, it would show up in the view, but we're going to just leave it for all of them. It'll show ten items on the page. We won't talk too much about the RSS feed and expose as block. They are pretty big subjects on their own. And I'll show you how to use that RSS feed in the video later on about publishing RSS feeds. But right now, we'll just leave it as it is and know that they are available for us later when we want to take a look at them. Click Submit, and that's actually all we have to do.
Now if we go to that page, new-tours-- and I can do that simply by clicking here-- we see the Channel Islands Excursion, Death Valley Survivor's Trek. You remember these were the three tours that we added most recently. If we click on any of these titles, it then shows us more of the information. I want to muck a little bit with this view so that you can see some of the different options that are available when you create a simple view. To do that, go up to Structure and then down to simple views again, and there is our Newest tours view. Click on edit.
Once again, I'll just go up to Structure, just to give you an idea of some of the different options, and edit it, and show a list of full posts, and submit. Now when we go to that new-tours page, we see the whole thing, all in one page-- great way to show a catalog of your different products, for example. Now when you make a view, chances are you'll want to add a link to a menu somewhere so that people can get to it quickly, and they don't have to type in "new-tours" or whatever the page address is.
You'll learn how to do that in the video about understanding menus. I hope this shows you how powerful simple views can be for displaying dynamic content. It's not always easy to see just how powerful it is, but I think once you start having lots and lots of nodes on your site, you'll start needing to organize them somehow. Then it'll become clear how simple views works together with taxonomy to keep your information grouped and easy to understand.
Get unlimited access to all courses for just $25/month.Become a member
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.