Viewers: in countries Watching now:
Drupal's built-in data presentation tools offer several ways for web designers to clearly and attractively package their data. In Drupal 6: Online Presentation of Data, Tom Geller explains how Drupal handles data so users can set up intelligent structures and implement them with Drupal's Content Construction Kit. Tom also shows how a data-driven web site can improve its interactivity by using geographic data to connect real-world addresses to maps. Exercise files accompany the course.
Way back about a dozen videos ago, I said that things there were going to get ugly for a while before they started looking good and if you've been following along, I'm sure you would agree. Our views have been pretty darn ugly up until now. But this is the moment you've been waiting for. With just a few clicks, the views are suddenly going to look a lot better. It all comes down to the Style option under Basic settings. Up to this point, we've left it on Unformatted, which just basically takes the data and spits it back out. But Views comes with three other options built-in: Grid, HTML List, and Table and some modules, such as the GMap module that we'll look at later, and other styles as well.
We'll start by changing the Block display a little. So, the first thing we have to do is go to the Block display, of course, and then we click on Style: Unformatted. Now, again, because it is italics, it has to be overridden or will override the default as well. Scroll down after we click it and click on Override. In our case, we want to change this into an HTML List. Don't worry, we'll look at the Grid and Table formats as well. We click on HTML List and Update and then we get some additional choices. Do we want it as an unordered list or an ordered list? We'll talk about the Grouping field in just a minute. For now I'll leave it as an unordered list. The ordered list version will have 1, 2, 3, 4, instead of just little bullet points. Click on Update and Save and since we have our block already showing in that left-hand column, you can see what it looks like.
It's a typical HTML list. The format of this list incidentally is determined by the theme in Drupal. You could have some themes, which show this is bullet points; others would show it as an icon and so forth. Let's also take a look at that Grid format. We are going to do that on our page view. Let's scroll up and see what it looks like right now. First, we save to be sure, good, and then take a look at the Page for family. I am going to open a new tab by right clicking. On the Mac, you may want to hold down the Ctrl key instead of right clicking and then Open Link in New Tab and let's see what that looks like. Okay, it's unformatted and straightforward.
We'll go back and change that to the Grid view and see what that looks like. First, we want to only effect the Page for family. Again, make sure that we override unformatted and then switch to Grid and click Update. Again, we have some choices, Grouping field, Number of columns and whether it is arranged first by listing them horizontally in order or vertically in order. I'm going to leave it on its defaults. Click on Update and Save and then let's go back to our page and reload. There is our Grid view. The data in the Grid view is now in a four-column table like structure that we wanted, but it really doesn't look great. We could do several things to make it better. For example, we could put space between the cells and make the text aligned to the top. You might notice that it is a little jagged here because it is aligned in the middle.
We won't deal with all that now, but we'll tackle those tasks in a later video about altering a view's appearance through CSS. Instead, we are going to spend our time looking at what is in my opinion by far the most useful of the built-in display styles, Tables. It is by far the most options as you will see, in fact, we are going to make the Table setting the default setting for this view since we'll want to be able to return to it easily after doing formatting experiments later on in the course. So, we'll go up to Edit, go back to our view. Make sure that we are affecting the Default display, of course, and we are going to change that to Table. Just as a reminder, nothing here is in italics because remember, italics means that it is in concordance with the default display. The Default display is always in concordance with the Defaults display. There is no override, so it just shows things as Roman type.
We are going to scroll down and change that to a table and Update. Here we have several options. What I usually do is I make all of my fields Sortable and you will see exactly what this means. You can also put several fields into one column of the table and separate them out. You can play with that as you like and we'll show a little bit more of that later in the course. But for now, we'll leave it mostly as it is in its default. The one thing we'll change, however, is to add the sticky table headers and you will see what that means in just a moment.
Click on Update, great. And since we did this to the default, we immediately see it in the preview down here. Remember how I made certain columns sortable? They automatically are, you just click on wherever the column name is and it resorts according to that column. As always, I like to save it. Now, after I saved it, it returned us to our Page view since that's where we were before. But you see we don't see it as a Table view even though we change the default. That's because we overrode it for the page. I want to make the page reflect the default. So, I'll go back over the ghost menu and edit it. It's already on Page for family and that's good and you see the style is overridden. I'll click on that, scroll down and then click on Table and then Use default. I should mention this is a little peculiarity in the Views administrative interface. If I were to click Use default now, it would actually change the default to Grid. It's a little bit backwards from what you expect. So, I'll just click Table and then Use default and then Update default display and now both the Page and the Defaults are on table. That's the way I wanted.
So, now that we have put our page in concordance with default, let's go back and edit that default. We go up to the ghost menu here, click Edit and then make sure we are on Defaults again. Once we are there, we'll edit the options for the Table setting and scroll down. We already talked about the sortable column here. You will notice that some of these things are not sortable. The headshot obviously isn't sortable because it is a field. It doesn't have anything to sort on; it's not textual information. However, Married to and Relationship are also not sortable. That's because remember those were both node reference fields when we created them in CCK and when you do a node reference, it only pulls over a small piece of information.
Well show you how to make those columns sortable in the videos about Relationships later on. We discussed how some of these things can be put in the same column. Let's do that right now, let's make our headshot in the same column as Name. We just change it here to Name, scroll down and click Update and Save. Just to go back to the page, now we see that both the headshot and the name are together in the same column. It doesn't actually look that good. So, I'm going to return it. We could, however, have put some sort of delimiter between the two such a slash as we did earlier between Date of birth and Married to.
I'll go back and put them back in their own columns. Another setting as you can see is the Default sort. I'm actually going to change this so that it's going to sort automatically by name. Now, you might wonder what happens if you have it sorting by name here, but also have a sort criterion up here. Well, they have to fight with each other and sometimes that does become a problem. Let's see what happens now because as you see up here, we have a Post date sort, but we also have a Name sort here. Scroll down, click Update default display, save it and if you follow it, you can see that the name is the one that went out. So, when you set it on the Table setting, it overrides the sort order you had made elsewhere. Another way to tell that it's sorting a name besides looking through all of the names is by this little arrow up here. If you click on Date of birth, for example, it will sort that way. Click it again.
The last thing to talk about is that Group by field. Right now we have two people in the database who are twins, Francisco and Francesca. I know, don't you hate when parents do that? We are going to go back to our Table style and group by that Date of birth since they obviously both had the same date of birth. Scroll to the bottom and let's see how that affected us. Well, it groups everybody that was born on the same date. In our case, it's only one person for each date until we get down to Francisco and Francesca since they were born on the same date, they appeared together grouped, and each one of these groups can be sorted individually.
I don't actually like grouping that way so I'm going to go back up and change that option, so we are not grouping by anything. And finally, as always we want to save our view. Now, we are starting to see how to make views attractive as well as functional. The next step in adjusting the views appearance is found in the video I mentioned earlier about altering a view's appearance through CSS. We'll also talk about all of those other miscellaneous doodads under the Basic setting rubric in other videos in this course.
Find answers to the most frequently asked questions about Drupal 6: Online Presentation of Data .
Here are the FAQs that matched your search "" :
Q: The exercise files for the course appear to be missing.
A: Full exercise files for this course were not provided because of the unusually large amount of images, modules, and other files that would have to be installed in specific places, in addition to the database. We hope to have a solution for future Drupal courses that installs all items in their correct places.
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
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.