New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Overriding default settings on view displays

From: Drupal 6: Online Presentation of Data

Video: Overriding default settings on view displays

Now we are going to launch into an aspect of Views that lets you add, remove and change features of a view from its displays. So we'll take our people view for example for which we have set up a page, block and feed. Right now they are all showing pretty much the same fields and they are all filtered in the same way and in the same order. That's because they are all based on the Views' Default display with no changes. But we are now going to override some parts of those displays to make them more appropriate for their applications. The Block view will show less information than the Page view because it doesn't have as much space to display it in and we'll sort it differently. They'll share many qualities of the default display, but will diverge in important and useful ways.

Overriding default settings on view displays

Now we are going to launch into an aspect of Views that lets you add, remove and change features of a view from its displays. So we'll take our people view for example for which we have set up a page, block and feed. Right now they are all showing pretty much the same fields and they are all filtered in the same way and in the same order. That's because they are all based on the Views' Default display with no changes. But we are now going to override some parts of those displays to make them more appropriate for their applications. The Block view will show less information than the Page view because it doesn't have as much space to display it in and we'll sort it differently. They'll share many qualities of the default display, but will diverge in important and useful ways.

That's easier to show than explain. So let's take a look at our Page, Block and Feed, and then we'll change them a little bit. As we go through our displays you will notice some differences, and quite honestly these differences aren't very well documented. We'll talk more about them in upcoming videos, but just very briefly I can point out a few. If we look at the Block display, we see for example this More link that doesn't exist for the Page display. Likewise there is this Link display, which doesn't appear in either the Page display or the Feed display. Some of these differences become important as you start overriding the default settings and we'll show those as we go. But first let's start by changing our Block display.

Now we can override pretty much anything we see here. One problem I had with the Block display was how much information it showed. In fact, let's go and administer blocks and show that Block display here in the right side bar so we can see the changes as we go. You remember we created the block with the administrative name people block. We'll put that in the right side bar and save. Now that's too much for a block. Let's change it by going up to these little ghost menus here and clicking on Edit. One good thing about those ghost menus is when you get back to the Views Administrative page that way it goes directly to the display you want. If you hit the Back button it very often won't. It will go to the Default display instead and you start editing the wrong thing, but here we are at Block.

We don't need all of this information. Let's only list the name. To do that I'll click on the Fields head here and then scroll down. We only have one option. That's to override or to keep the defaults. We click on override and we are told that we are using overridden values. That's a warning. We can always switch back by going back up there and clicking on Use default. But we do want a difference so we'll click on Update. I want to scroll up again and point out something. You see how all of these things are in Italics. That means that they are exactly the same as the Default display. The parts that have changed are shown in non-italics or what's called Roman type.

We are now going to remove all the fields except for that name. There are two ways we can do it, we can do it one at a time, for example clicking on the headshot, scrolling down, and then clicking Remove and then Save, and as you can see we've removed it from that side bar. However, we haven't removed it from the page. Let's go back to our View by going to Administer, Site building, Views and Edit. We can actually take a look at the page and see that the headshots are still there or they are not in the block. We are going to go back and edit that block again.

The other way we can get rid of several fields at once is using this Rearrange button. Click on it, scroll down to our options, I'm going to delete everything except for the title which is the person's name. Note that as we are doing this we are reminded that we are using overridden values. That's very valuable to see because often you'll forget exactly what the default is, what's overridden and so forth. We click Update and Save. And we are back at our page because when you save a view it brings you back to where you were before. That's perfect because now we can see we have the page version here with all the information and the block version here with less information. We could continue to edit this to make it even better. Let's edit that Node title, we don't need to say name before each one, scroll down, get rid of the label, and let's link the field to its node, I often do that, scroll down and Update and Save.

We are back at our page, and we see here one version of the view over here, and another one over here, great. But we can change more than just what fields are showing. You can also change the Sort criteria. So I'll go up here and add a criterion. We wanted to sort so that the most recent ones were at top. That's going to be Node: Post date. There also is Node: Updated date. Either one. Whichever one is appropriate to you. We'll click on Add. The Granularity lets you make it so that things that appeared on the same day or the same month don't seem to have appeared before each other. So you could for example say this is everything that appeared may, (ph) and no one thing seems more important to our earlier than another.

Now we could click on Update default display here, but you notice it says default display, we are still going to be changing the default, and if we make this change now it will happen both on the block and on the page and on the feed. We want it only to happen on the block, so we have to remember to click Override. The other thing I want to point out is Sort order, Ascending or Descending. Sometimes it's hard to tell which is which with dates. Is a later date ascending or is an earlier date ascending? I'm just going to leave it as it is and see what it looks, then I can make my decision. But for now we click Override, Update and Save. We don't actually know which appeared earlier or later, so we could go back and actually add a field. Once again we've already overridden all of the fields, so we'll add one, scroll down and add Node: Post date, Add. Again we are warned that we are not using the default. I'm going to have the Date format say how long ago were these added? And you can change the Time format and so forth, but we'll just go Update and Save. Ah, now we can really see that we actually have the oldest ones appearing at the top. Of course we could go back and change that fairly easily by changing it to Descending. We can also change this field so it doesn't say Post date, why don't we go ahead and do that? We are at the point now where we know Views well enough we can clean them up as we go. I scroll down. Get rid of the label, and Update and Save.

There is one more thing though that we haven't quite done, people don't know what these are, so let's add a title to that block. Edit the block again, and here again you see how it's in Italics. If we add a title here and we don't override, it will be added to the page as well to the block, which won't be appropriate because what we wanted to say is here are the most recent ones. So I'm going to override Recently added, Update and Save, and there we have it.

It's looking better and better. We could continue to make it look good in many ways, I'm just going to do one or two very quick things because this will help un-clutter our page. Items to display, I'm going to change just 3, but remember I have to override, and Update and Save. Now we only have three. I edit it one more time, and I'm going to add a More link, again it's in italics, so we have to be sure that we change that by overriding, Create more link and Update. The More link will add a link to the bottom of that block which will go to the full page, very useful, and incidentally that's also what that link display means. So you can tell the Block view exactly where it should go when somebody clicks on More.

I know I'm throwing out a lot of little things here and will go into many of them in greater detail later. But I really want to drive home the idea that you can override things in the Page, in the Block, in the View so they all look different, and in fact give much more useful information because they fit their spaces better. As I said I now have a More link that goes to this page, excellent! Now the last thing that I want to do is we've created this block I'm actually going to remove it from that right column, and the reason for that is as we go through the course you will notice that the View Screen actually gets quite crowded when you have things in both the left and right column. So I'm going to go to Administer, Site building, Blocks, scroll down and move that people block back into . We'll be adding it later when we pretty this site up in the last video.

Scroll to the bottom and Save, and let's just go to our homepage so we see everything looks as it did. Displays in a single view could have no resemblance to each other at all. They could have completely different field, sorting, arguments everything. This flexibility introduces an architectural question though. When should you create a new view and when should you just add a display to an existing view? That's a subject of some debate, and it's ultimately decided by your particulars style of web development. Don't worry too much about being wrong. Just develop Views using the way that's clear to you, and that will be clear to any other Drupal Administrator who'll ultimately be working with your views.

Show transcript

This video is part of

Image for Drupal 6: Online Presentation of Data
Drupal 6: Online Presentation of Data

50 video lessons · 11180 viewers

Tom Geller
Author

 
Expand all | Collapse all
  1. 12m 56s
    1. Welcome
      1m 12s
    2. Reviewing requirements
      3m 35s
    3. Using the exercise files
      3m 11s
    4. Touring examples of data visualization
      4m 58s
  2. 27m 56s
    1. Planning data structure
      8m 26s
    2. Importing and manipulating data
      6m 40s
    3. Looking at Drupal's database
      6m 13s
    4. Deciding whether to store personal data as nodes or users
      6m 37s
  3. 1h 13m
    1. Understanding the Content Construction Kit (CCK)
      4m 57s
    2. Creating new content types with CCK
      7m 26s
    3. Hiding the Body field
      2m 46s
    4. Reflecting CCK field data in the Title field
      7m 28s
    5. Managing CCK field placement
      7m 34s
    6. Exploring CCK's other features
      8m 22s
    7. Using other CCK field types
      3m 25s
    8. Adding date information as a CCK field
      8m 43s
    9. Including images as CCK fields
      10m 23s
    10. Connecting content to existing nodes
      5m 58s
    11. Using taxonomies to categorize and group data
      5m 59s
  4. 53m 54s
    1. Understanding why views are useful
      6m 12s
    2. Using SimpleViews to create basic content views
      5m 49s
    3. Diving into the Views interface
      11m 16s
    4. Adding fields to a view
      7m 12s
    5. Understanding iconic controls in the Views interface
      7m 15s
    6. Surveying the Sort, Filter, and Field options in Views
      5m 40s
    7. Adding view displays as pages, blocks, and RSS feeds
      10m 30s
  5. 43m 34s
    1. Overriding default settings on view displays
      8m 56s
    2. Attaching more information to views
      10m 57s
    3. Improving view appearances with grid, list, and table formatting
      9m 20s
    4. Surveying other basic display settings in Views
      11m 3s
    5. Altering a view's appearance through CSS
      3m 18s
  6. 55m 8s
    1. Importing, exporting, and cloning views
      6m 9s
    2. Controlling access to views
      7m 19s
    3. Learning from built-in views
      5m 52s
    4. Creating views that aren't based on nodes
      10m 6s
    5. Extending views with arguments
      10m 17s
    6. Extending views with relationships
      7m 2s
    7. Going further with relationships
      8m 23s
  7. 46m 40s
    1. Understanding geographic data
      4m 26s
    2. Setting up the Location module
      16m 20s
    3. Entering geographic data with the Location module
      10m 10s
    4. Displaying basic maps with the GMap module
      6m 43s
    5. Integrating the GMap module with Views
      9m 1s
  8. 54m 21s
    1. Exporting data in tabular form
      11m 25s
    2. Planning with the calendar modules
      11m 31s
    3. Using the Charts module and Google Charts
      7m 11s
    4. Graphing data with Open Flash Chart
      4m 50s
    5. Making important data pop out with tag clouds
      7m 46s
    6. Putting it all together in an attractive package
      11m 38s
  9. 36s
    1. Conclusion
      36s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold

Are you sure you want to delete this note?

No

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.