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

Attaching more information to views

From: Drupal 6: Online Presentation of Data

Video: Attaching more information to views

One data display often compliments another. Let's take vote counts from a presidential election, for example. A two color map that shows that leading candidate in each state provides one sort of information and that's a kind that's easy to understand at a glance. A table of vote counts provides details that would cluttered up such a map, but if you put the two together on a newspaper page then well, you get the kind of impactful informative combination that made USA today so successful. You can do the same thing with your Drupal displays. First, by changing some options in the Basic settings section of the Views administrative interface and secondly, by taking advantage of a kind of view known as an Attachment.

Attaching more information to views

One data display often compliments another. Let's take vote counts from a presidential election, for example. A two color map that shows that leading candidate in each state provides one sort of information and that's a kind that's easy to understand at a glance. A table of vote counts provides details that would cluttered up such a map, but if you put the two together on a newspaper page then well, you get the kind of impactful informative combination that made USA today so successful. You can do the same thing with your Drupal displays. First, by changing some options in the Basic settings section of the Views administrative interface and secondly, by taking advantage of a kind of view known as an Attachment.

First, let's take a look at the Basic settings options. We've already touched on a few of these in other videos in the series. Now let's put all that learning in one place. I should warn you though, in my opinion, the Basic settings administration area is kind of a mess. It includes some pretty random stuff, and not all of it attaches information to your views. Here are some parts that do. In the Basic settings area, the Title and Header generally go at the top of your information, while the Footer, as its name implies, goes at the bottom. By default they're all turned off. That is, there is no Title, Header, or Footer.

We are going to go back to our View, and we are going to add a title, a header and footer to the default, so we'll see them in the block and the page. Just to be clear, I'm going to make the Title, This is the title, update it. The Header I'll say This is the header, and update it, and the Footer I'll say This is the footer. Now you may have noticed that with the header and the footer, we can actually enter HTML or any other input format that we have installed in our Drupal installation. In fact, I'm going to go back, and I'm going to change the header, so it's a little bit bigger, I'll say

and close that tag, of course. Make sure our Input format allows that by changing it to Full HTML, and click on Update. Good.

Now let's save that, and take a look at our page. You see there is a title, the header, which as we made it bigger, shows up large, and then at the very bottom, we see the footer. Now let's go and take a look at how it looks on the block. We'll go to Administer > Site Building > Blocks, and turn on the block that we'd created called People block. We'll put that in the left-hand sidebar. Scroll up just to see where it is. Yup, it's going to be above the Navigation block, scroll to the bottom, and click Save blocks, and go back Home, and there it is.

We see how the header appears, but actually the title doesn't appear in a block. That's important to know that these header, footer and titles don't always appear quite the same way as you expect them in the different formats. In any case, we don't really want them to say this is the header, this is the title, and so forth. So let's go back and edit them and remove those things. We want to see what that block looks like, so we go back to our Blocks page, and turn on the block we created called People block, and we'll put it in the Left side bar. Scroll down and save, and as we scroll down, we see it here. Now you see there is the This is the header, and This is the footer, but not the title. If we go back and edit that view, we'll see that it's in Roman characters, not italics; we had edited that earlier, we had overridden it.

If we switch up to our defaults, we see our This is the title. Let's get rid of that default title, header and footer, we don't really need them. So I'll delete that and update; delete the header and update; delete the footer and update. I do want to mention this display even if the view has no result. Sometimes you'll do some sort of complicated view that will pull in information but won't always get any. In those cases, you might not want the header to show, because it would look strange. You can specify that right here. Click on Update though, and we have gotten rid of those default header, footer and title, although, of course, we still have that title in the block, because we overrode it. Click on Save. Good. So that's the first way that you could add information to a view.

The second is using Attachments. To get there, we'll go back to our View, under Administer > Site building and Views, and Edit the People view. The one that I want to work on is this Recently added here. I like the way it is now. It's showing the three most recently added people to our site, but I want the first one, the most recently added to be bigger than the others, maybe have a headshot there. We can do that using an attachment, and by changing the way that this particular block is arranged. The first way I'll do that is create the attachment. Go to Page, and Attachment, and Add. For the Title, I'm going to override it. This is just going to show the very most recently added person. I'll override it and say Welcome our newest member, and update.

Again, this is going to go in the block area here, so we don't need all of the default fields. We are still on the Attachment display. Remember to always check which display you are working with, and I'm going to override the fields, and then click Update. Now I'm going to remove all except for the Title, and the headshot, I click on the Rearrange button, which brings up our option of deleting multiple fields at once. Click to delete the ones I don't want, and then click Update. Now here is something interesting. We don't actually have a preview of the attachment, and is obvious the way as we'd like. When you go down to this preview, you have to select the thing that you want to preview. Take a look at our attachment and there it is. It's just the name with a headshot. I'm glad I did that too, because I don't really need the word Name there. I'll go up and get rid of that. Scroll down and update. There, much better.

We can do even more by making that name bold. To do so, we go over to its field, which remembers the Title, and then scroll down so that we can see all of our controls. The part we are actually going to change is we are going to rewrite the output of that field, by clicking in this box here and then adding the title itself with bold tags around it. Now how do we add the title? If you look down, you see these replacement patterns. There is only one available to us here, the title. So we'll copy it, and paste it in here, and then add our bold tags before and after, and scroll down and click Update and see if that works. Indeed, everything is now bold.

Now let's go back and remember why we are doing this. We have that group on the side of the screen, which shows what are most recent members are, but we want the very first one to have this name and photo. To do that, we have to have it sorted, so that the most recent person comes to the top, and at the moment we have the exact opposite, the oldest person, the first one that we added comes to the top. So let's change our sort order first and foremost. We have a default sort order to have it going from oldest to newest. We have to first override that, we'll click on Sort criteria and scroll down, and click Override, so that we don't change the default display, and update. Now, of course, that didn't change our sort order yet. It just said that when we do change it. It's not going to affect the default display. And we see that it's in Roman characters here, so we know it worked. We'll click on that again, scroll down and change it from Ascending to Descending and click Update. We know it work because there is our most recent person, Dani. Very good.

The next thing that we want to do is show only one person with the picture, and then everybody else will show up. So this first one over here, Danni de Nada, should have her picture but then Dave and Sophie should not have their picture showing. To do that, we scroll up and we see how many items to display. It's in italics. That means that our attachment is using the default value. The first thing we have to do is to override that. We do that by clicking on the value, go down and click Override and Update.

Now we go back up, click on the value, we see it's in Roman, so we know it worked, and then we can change it just to 1. I always do this in two steps, by the way, just to make sure that I don't change the default value. I've done that a few times, and it could be quite messy when you change the default values, then go back and see that your pages were all sorted wrong, and have the wrong fields, and so forth. Anyway, we'll click Update, and now we should only see Dani, and indeed we do. Very good. The next thing that we want to do is make it so that attachment appears above this block. The way you do that is in the Attachment display here. Down at the bottom we have the settings that are specific to attachments, and we see Attach to, we want it to be attached to the block, so we click on that None, and that shows us what our options are.

We can attach it to all of them, the defaults, just the Page, just the Block, or any combination of those. We just want it on the block, and we click Block and if you look up, you'll see we have a choice also Before or After, but we want it Before, so that's fine. Click Update, and then click Save. Let's take a look at what this actually looks like on our page. Aha! We are almost there, we have the picture that we wanted, and the person's name in bold, but then underneath it, you'll notice something; we have the person's name again. We have it showing once with the picture, and that's the attachment, and once with the block. Let's go back and fix that. Click on Edit to go back to edit the view, and then we want to change the block. Remember, we have the attachment showing one object, and then we have the block showing three more but repeating the first one.

We click on Block, and change Items to display. Fortunately this is already overridden, so we don't have to do it again. Click on it, scroll down and see what we have. Here is where the magic happens. We want to show 3 in addition to Dani. We could change it, of course, but let's say we want to show 3, but we are going to offset it by 1. Click on Update and now instead of seeing Dani de Nada here twice, we should just see it once. Update and Save, and there you have it. We now have Dani followed by Dave.

There is one more thing that I'm going to do. I want to separate this graphic even further from the rest of the people. So I'm going to put a line between them. To do that, I'll go back up to Edit, and add something at the bottom of the Attachment. Now you might ask how can you add something as arbitrary as a line? Well there is a Field control you can get to by clicking on the plus sign, and then scrolling down, and under Groups, select Global. Here you have the option of putting any text you want. I'll select it and click Add, and I don't really need a label; it's just going to be the text itself, and the text I'm going to add is going to be a break, followed by a horizontal rule, followed by another break. That will put a little bit of space around the lines. Scroll down to the bottom, Update, Save and there it is. There is our little line.

We'll come back to using attachments in another video, and in fact, they will play a crucial role in making our final site a real doozy. One technique I'd encourage you to learn is to keep your attachment small. Very often it works best to have attachments as introductory or side content that frames a view's main display sort of speak. If you throw too many big different attachments into the mix, the point of lost, the page or the block can quickly get but if you keep them simple, as we've done here, they have quite an effect.

Show transcript

This video is part of

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

50 video lessons · 11361 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
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Drupal 6: Online Presentation of Data.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

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.