navigate site menu

Start learning with our library of video tutorials taught by experts. Get started

Drupal 7: Reporting and Visualizing Data

Drupal 7: Reporting and Visualizing Data

with Tom Geller

 


In this course, author Tom Geller demonstrates how to use the Views module and other add-ons in Drupal to present dynamic, data-rich content. This course examines several real-world examples of effective data visualization and describes the Drupal data-storage model. The course also shows how to create, format, and style views; control access to data; improve data administration with Views Bulk Operations; and display content as custom maps and slide shows.
Topics include:
  • Planning the data structure of a site
  • Creating record templates with custom field types
  • Connecting fields using references
  • Sorting and filtering data
  • Varying how a view appears in different displays
  • Formatting views with grid, list, table, and jump
  • Creating multi-part views using attachments
  • Importing and exporting views
  • Extending views with relationships
  • Understanding and using location data
  • Exporting data

show more

author
Tom Geller
subject
Developer, Web, CMS, Web Development
software
Drupal 7
level
Intermediate
duration
4h 24m
released
Nov 17, 2011

Share this course

Ready to join? get started


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:04Hi! I am on Tom Geller and this is Drupal 7 Reporting and Visualizing Data.
00:09Drupal is one of the most popular ways to publish information on the web, but
00:13what's not is well known is that it's a great way to collect, manage and display
00:17data from any source.
00:19You could collect news items about a topic that interests you, for example,.
00:23Best of all, you can mine data from any Drupal site you already have, fully
00:27unleashing its power.
00:28We will take advantage of features that are new to Drupal 7, such as Entities,
00:33and dive deeply into the Drupal add-on called Views.
00:37When we're done, you'll hear how to turn an ordinary Drupal web site into a data
00:40driven one, that presents information clearly, dynamically and in engaging ways.
00:46Let's get started with Drupal 7 Reporting and Visualizing data.
Collapse this transcript
What you need to know
00:00This course assumes that you already know a little bit about Drupal, in fact, we
00:04will start with Drupal already installed.
00:07That's not hard to do once you know how, but it can be daunting the first time.
00:11If you haven't done so already, follow the installation instructions in my
00:15lynda.com course, Drupal 7 Essential Training.
00:18There are a few other things you will need to know how to be able to do as well.
00:22You'll need to know how to navigate around drupal.org.
00:26drupal.org is the center of the Drupal community and it's where you will
00:29find all of the information and software that you will need to add to your Drupal setup.
00:34I will tell you specific URLs to go to during this course.
00:38However, the better that you know the site drupal.org, the easier you'll find
00:41things that you need.
00:43You also need to know how to install necessary modules;
00:46I will show you this very quickly as we go through the course, but it's
00:49really quite simple.
00:51If we go back to our site here, you see how to do it by clicking Modules, then
00:57Install new module, and then you'll paste in the URL that you have copied from
01:02drupal.org and click Install.
01:04There are a few steps after that, but again, you'll see them throughout the course.
01:07You will also need to know how to turn on those modules.
01:11Once again we go back to our site to see how that works, and it's once again
01:15in the Modules screen.
01:17To turn them on, you simply check these boxes, scroll down to the bottom of the
01:21screen and click Save Configuration.
01:24You might need to check some boxes before others and go through this process a
01:27few times, but once again, I will show you that during the course.
01:31Finally, you'll need to know how to create and edit content.
01:35It's not very difficult to do, you just go up to Add content, select the
01:40content type that you want to add, fill out the form and then when you're
01:44finished, click Save.
01:47Although it's not essential, I also strongly recommend that you get an
01:50account on drupal.org.
01:54That lets you take part in discussions which will improve your own Drupal
01:57experience and lets you file bug reports which could improve the project for everybody.
02:02It's free and it only takes a moment.
02:04Just go down to Log in/Register to create a new account, click here and go
02:09through the process.
02:11That's all the knowledge that you'll need, but you'll also need to install two
02:14additional modules they are called Chaos tools and Views.
02:18I will show you how to do that now.
02:20The first address that you need to go to is drupal.org/project/ctools, scroll
02:27down and select the most recent stable version, that's the one that's going to
02:31be in the green area here.
02:33Throughout the course whenever you get a module make sure it's one that starts
02:36with 7 so that it's compatible with your version of Drupal, the one starting
02:40with 6 simply won't work.
02:42I copy this URL, go back to my site and click Modules>Install>Paste, click
02:54Install, wait for it to upload and enable it if I like, by clicking Enable
02:59newly added modules.
03:01You could scroll through this page and find the module that you want, one trick
03:04that I use to get to it quickly is by closing the groups that I don't need.
03:08So I click this CORE group, I know that it's not in that group.
03:11And here's the CHAOS TOOLS SUITE and I can enable the modules that I need.
03:15But before I do that, I'm going to go back to drupal.org and get the other
03:19module I need, it's at drupal.org/project/views.
03:24Once again, I scroll down and select the version I need, copy its URL, then go
03:30back to my site and install it by going to the top of the Modules page, and
03:33Install new module, Paste and Install.
03:40Now I am ready to enable all of the modules I have installed.
03:45Go back to the Modules page, close up CORE.
03:47Now instead of enabling these CHAOS TOOLS SUITE modules, I am going to go
03:51straight to Views and enable both of its parts.
03:54As you will see, when I click Save Configuration, it knows that it needs the
03:58CHAOS TOOLS MODULES in order to turn on Views.
04:02So I will just click Continue and let it do the hard work.
04:05Now if I scroll down, I see that by turning on Views, I have turned on only
04:10those parts of Chaos tools that were necessary.
04:12Here is a list of all the URLs you will need to download software for this course.
04:17They all begin with drupal.org/project, then for drupal you go to /drupal,
04:22drupal.org/project/drupal, for CHAOS TOOLS it's /ctools,
04:23drupal.org/project/ctools, and for views it's /views, drupal.org/project/views.
04:26We will install other modules later in the course.
04:30But that's pretty much it.
04:31Again, we won't be doing anything terribly fancy in Drupal, but you'll probably
04:36want to, after you start building your data driven site.
04:38If you have any problems check out Drupal 7 Essential Training.
04:42If that course doesn't have a video that answers them, try watching the video
04:46Getting help with Drupal issues from that course.
Collapse this transcript
Using the exercise files
00:00If you have access to the exercise files for this course, you have all the
00:04components you need to follow along with the videos on your own computer.
00:08Working through this course involves two kinds of files, the first are content
00:12files such as text and images, the second or site files;
00:15I will get to that second group in a minute.
00:17You will find as you go through the course that sometimes there will be text or
00:22image files inside a folder. For example;
00:24here we have an image file.
00:26If you don't have access to these exercise files, you can use your own stuff to
00:30follow along, and you'll be fine.
00:32I recommend that you go through the course in sequence from beginning to end.
00:36If however, you want to jump ahead, you'll need to align your Drupal site and
00:40the associated database to the relevant movie.
00:43That means restoring it from the files that are included in the exercise files.
00:47There are two different procedures for this, the first procedure happens only
00:51the first time you set up your site.
00:53You don't have to follow this procedure, if you've already installed Drupal
00:56through some other method.
00:58The second procedure is once your site is up and running, I will show you both now.
01:02The first time you are going to using what's in this folder base-site, simply
01:07open it up, copy this twotrees folder and put it wherever you'd like your Drupal
01:12installation to be, this may take a while.
01:15I should mention that this includes Drupal as was current when I made this video.
01:20By the time you see this video, chances are there will be a newer version
01:24of Drupal available.
01:25You'll be fine as long as you don't launch this onto an actual public web server.
01:29However, if you do, I very, very strongly recommend that you update your
01:34Drupal installation;
01:36otherwise you could be open to all kinds of security holes.
01:39For information on how to do that, see Drupal 7 Essential Training.
01:43The next step is to import this folder into the Acquia Dev desktop.
01:49If you don't have it already, you can get it at acquia.com/downloads.
01:54It's available for both Windows and Mac and it doesn't matter which version you
01:58grab, for Drupal 7 or Drupal 6.
02:00Since you are going to be replacing the version of Drupal that it comes with,
02:04again, for more details see Drupal 7 Essential Training.
02:08I already have Acquia Dev Desktop running, so let's import the site.
02:11We go down to this localhost pop-up and then go to More and then click Import.
02:18We click Browse at the top here and navigate to our folder, twotrees, then click OK.
02:27We're going to create a new database and it has to have the Name twotrees.
02:35Likewise, the Server name also has to be twotrees and then click Import.
02:42If you are normally installing Drupal, this is where you would step through the installation.
02:47However, we're going to bring in a database that we've previously saved out.
02:51To do that go back to Acquia Dev Desktop, close out this window, so that you're
02:55back at the front of Acquia Dev Desktop and click Manage my database.
03:01Here you see the twotrees database that was installed by Acquia Dev Desktop.
03:05If we click it though, we see that the database is still empty, because it never
03:10finished its installation profile.
03:12That's fine, we're going to import a database, by going up to Import
03:16and clicking this tab.
03:19We then click Browse and go to the files that we want.
03:23We are going to use this exercise folder;
03:30this contains a very basic database without much stuff in it.
03:34The file that you want ends in .sql.zip, twotrees.sql.zip, click it and then click Open.
03:42Finally, click Go, this may take a while.
03:45I found that some browsers have a bug that doesn't let you do this import
03:49completely, most reliable is Firefox.
03:53By the time you see this video that bug may have been solved already.
03:56So you may be able to use any browser, try out different ones if you find that
04:00it hangs at this point.
04:01When finished, you will see a message similar to this one.
04:04We can then go back to Acquia Dev Desktop, select twotrees and say Go to my site.
04:10If everything worked right you will see the site just like this.
04:14Note that the Username and Password throughout the entire course in the
04:18exercise files is admin and the password is drupal, all lowercase, drupal, and then login.
04:28Now you're ready to go.
04:29So that takes care of the first time you set up your Drupal site using
04:32the exercise files.
04:34If you want to move ahead in the course, there is a slightly
04:37different procedure.
04:38To show you that I will go back to my desktop and open up my Exercise files.
04:44Let's say that we want to go all the way ahead to 0501-displays, I will open up
04:50that folder and we see there are two folders inside it, the database, which we
04:54will be using in a minute and the sites folder.
04:57The way that you use the sites folder is you first go to your Drupal
04:59installation and throw away your old sites folder.
05:04Keep in mind that this will destroy the site as it is when you leave it and
05:07before you do this update.
05:09If you want to save it, follow the procedures you saw in Drupal 7
05:13Essential Training.
05:14But let's say we just want to go ahead, so we'll take the sites folder and throw it away.
05:18We will then open up the sites folder here;
05:22it's compressed so you may need an uncompression utility.
05:25The one that I like is called 7zip.
05:28If you're using Mac or a later version of Windows, you probably don't need this,
05:33anyway, let's go back for desktop.
05:35And there is our folder, we open up that compressed file and we drag the sites
05:40folder into twotrees.
05:44So it's replacing the sites folder that was there.
05:47This may take a while.
05:50That's the first part of the equation.
05:52The second part is to replace the database, for that once again we go to our
05:57Aquia Dev Desktop Control panel and click Manage my database, then click
06:04twotrees, we will scroll to the bottom, select all of these tables here by
06:10clicking Check All and then say Drop.
06:13Again, this will destroy your site as it is now, so make sure you backup if you
06:17want to save it, but we don't so we just say Drop and we have to confirm whether
06:21we really want to do that, yes we do.
06:25And if it works, you will see this message up here.
06:28Now we import the database from the exercise files.
06:31To do that, we click Import, then click Browse, we find the exercise file that's
06:39in the folder that we want to update to.
06:41For us that was 0501-displays, open it, select the .sql.zip file and then
06:50click Open, then Go.
06:53This may take a while.
06:57If everything works correctly you will see a lot of tables listed over here
07:01under twotrees and you will see this message saying that the import has been
07:04successfully finished.
07:06We can tell if that's true by going back to our site, once again, Acquia Dev
07:10Desktop, select twotrees and go to my site.
07:15And there it is, once again the Username and Password is always admin and
07:20drupal, we login, and we are ready to go.
07:24I want to reiterate that when you do this, you will have an old version of
07:28Drupal, as well as old versions of modules on your computer.
07:31If you want to update those, go to Reports and Available updates, complete
07:39instructions on how to update both Drupal CORE and the Modules, once again, are
07:44on Drupal 7 Essential Training.
07:46Now I know that seemed like a big long procedure, but believe me, you get used
07:50to it and I have to admit that it doesn't always go as smoothly as you saw here.
07:55If you have any problems, first check my site tomgeller.com, I post help
08:00tips there as needed.
08:02If all else fails, go to the Support menu on lynda.com, then click Contact Us,
08:09and send an email through this form.
Collapse this transcript
1. Data Visualization Gallery
A yoga studio
00:00Before we start talking about how to report and visualize data using Drupal 7,
00:05let's delve a little into why?
00:07By looking at a few examples of Drupal sites that use the techniques that you
00:10will learn and use them in interesting ways.
00:14Now when I was writing this, I thought I would have to search all over for good
00:17examples, but the fact is almost all Drupal sites use some data display tricks
00:22that go beyond what Core Drupal allows.
00:25To find these sites, I went to the Drupal showcase at drupalshowcase.com.
00:29The first one I found is for a yoga studio in Philadelphia, that site is at wakeupyoga.com.
00:36So let's take a look at this page.
00:39One way to tell which parts of a site are data driven is to look for things that
00:42are likely to change regularly.
00:44There are the bits that are dynamically generated. For example;
00:49take a look at this Today's Classes group over here, probably this is from a
00:53group of classes each one being an individual node in Drupal and then collected
00:58in some interesting way.
01:00Now it's possible that somebody's getting up really early, even before the
01:04yoga people and as you know they get up really early themselves, to change
01:07this everyday manually.
01:09But probably it's happening automatically, using some sort of data collection system.
01:14Let's take a look, when I click on the Rise & Shine link, I see what looks like
01:20a node and you can see that it has a set of fields, teacher, whether or not
01:25there is preregistration, the times and so forth.
01:28Let's take a look at some of the others.
01:30Yup, they all follow a very similar pattern which also suggests that they're
01:35coming off of the same Content type in Drupal.
01:38From wandering around the site I can start to floss out some things about how it was built.
01:42For example;
01:44let's take a look at Schedules, here we see a calendar view which also has all
01:49of these different classes, there's our Rise & Shine and if we click it, we go
01:53right back to that same screen.
01:56This group of teachers is probably also a data collection set.
02:01We see here when we click on any one of the teachers, it's a very similar format.
02:05For example;
02:06each one has a picture, a name a little thing at the beginning and so forth.
02:11Again, this is probably all based on a pattern which is defined by a content type.
02:16Let's go back to the homepage and take a look again at some of these
02:19individual classes.
02:22When I click on any one, I notice also that there are links up here at the
02:25top, South Philadelphia the location and Peak of the Week, which I assume is part of a series.
02:31When I click that I see all of the classes in that series, this may very well
02:36be through a taxonomy in Drupal, and you will learn how to do that later in the course.
02:41So there are two techniques that you will learn.
02:44There's this one, the Taxonomy links that is the ones that lead you to a list
02:47of similar information and you learn about that in using Taxonomy fields to create Categories.
02:53The other kind of link you will learn about is in the video connecting two
02:56fields using references, that's how we are able to look at any one of these
03:00courses and see who teaches it, when we click there, we are making a reference
03:05to the person who teaches it from the node.
03:09That showed us a little bit about how this site reports and visualizes data.
03:12Let's look at a few other examples, so we can see how different sites do
03:16the same thing.
Collapse this transcript
A national organization
00:00Now I'd like to show you another example of data visualization, the National
00:04Campus and Community Radio Association of Canada or NCRA.
00:09There are thousands of nonprofit organizations like this one using Drupal, from
00:13Greenpeace, to the Electronic Freedom Foundation, to the World Food Program.
00:17But I chose this one specifically, because it's comparatively small and it uses
00:21data visualization in ways that are typical of a small organization.
00:25It also has one really eye-popping use, which we'll get to at the end.
00:29But to start, let's take a look at the links in the left sidebar.
00:32For example, the Member Directory, this is a perfect example of when you would
00:36use data visualization.
00:38Each one of these items, AMARC, AMI and so on, is a collection of fields.
00:44It's obvious that there's a name which is linked of course that's probably the
00:47title of the node then the spelled-out name that might be another field, the
00:52address, phone, and so on.
00:53There is also a little graphic here.
00:56If we clicked through the title to any of the full nodes, we get a little bit
01:00more information, but it's basically the same thing.
01:03In fact, they reuse this graphic in a different size.
01:06That's done automatically in Drupal, and we'll show you how.
01:10Let's go on to another example.
01:11Over here Our Funders, this is very similar, but as you can see it's not quite
01:16as complex it doesn't have as much information.
01:19It's just the title, a graphic, a link and then some body text.
01:24But again, it's essentially the same as our earlier example.
01:27Here is one more I'd like to show you.
01:29If we scroll down to this Job Board and click on it, we see active jobs but we
01:34also see an Archive of old job listings.
01:37Each one of these has a closing date which is interesting, because it points out
01:41a possibility using Drupal.
01:43The list of active jobs might only be those things that have a closing date in the future.
01:48You can set up Drupal so that it only shows you things based on date, very handy.
01:53It means that nobody actually has to go in and remove any of these jobs;
01:57they simply disappear after the closing date is passed.
02:00Finally, I want to show you that eye- popping example by going to our front page
02:04and showing you this map.
02:06It's not just a graphic.
02:07These pins are actually data driven pieces of information from within Drupal,
02:12as you see, when you hover over it, it gives us a little bit of information and
02:16if we click any of the pins, we get all of the information about this
02:20particular station.
02:22Here is something curious though.
02:23If we go over to the Member Directory, we get exactly the same information, but
02:28in a different form.
02:29So as you can see, you only have to set up the data once, then it can be
02:33presented in multiple ways from there on.
02:36This site I think collects the information well and makes it easy to access.
02:40But it does miss a few opportunities with data display.
02:43The next site we'll look at goes much further, even though the information
02:47itself is no more complex than the stuff you saw here.
Collapse this transcript
An entertainment company
00:00The last two sites we looked at were pretty low budget, that's fine I'm
00:04guessing that very few people watching this video have enormous budgets for
00:08their own web site projects.
00:10But now let's see how data visualization fits into a site that spent a lot of
00:14money and time on making their graphics pop.
00:17For this, I chose the site of one of the most visually rich properties
00:20around, the Star Wars game;
00:22it's at swtlr.com, Star Wars, The Old Republic.
00:28Now I'm not going to get into the visual stuff.
00:31As you know, lynda.com has lots of videos that'll show you how to get results like this.
00:36And the course on Drupal theming will help you to integrate those into your Drupal site.
00:40Now we're going to look past the Flash, and you'll see that the data portion of
00:44this site is actually quite simple.
00:46In fact, I'll tell you how to do all the data manipulations you need before the
00:50end of this course in order to make a site like this.
00:53Let's start with this latest news part down here.
00:56In this block we have three things to click on at the top, latest News, New
01:00Media and Recent Updates.
01:03Each one of these is a collection of stories and we can click on any of these
01:06links to go to that story itself.
01:08Like so, and, like so.
01:10This is giving us a little teaser of what's behind the node and if we click the
01:14Read More, we see the complete node, and in fact, if we look at each of these,
01:19we'll see a very similar format between all of them, they have all of this body
01:23text up here and maybe some images, and then down at the bottom they have tags,
01:28as well as a link to Comments.
01:30That's one way you can tell if you're looking at a data driven site.
01:33If all of the formats are the same on similar pieces, probably they're
01:37defined by a content type, but let's go back and scroll back down to the
01:42bottom and there we are.
01:44This group of node is probably done through a view, and in fact, this thing
01:48where you can switch from one tab to another was probably done using
01:51something called Quick Tabs.
01:53You can find it on drupal.org, at drupal.org/project/quicktabs.
01:55I actually use it on my own site as well, tomgeller.com.
02:03This is the same exact thing, it's the same Quick Tabs that they're using on
02:07Star Wars, The Old Republic, of course, theirs is more dressed up, but it's the
02:10same basic technology.
02:12Now let's go back up to the top and take a look at some of the other parts of this site.
02:16We have this Community menu, let's go down to Events.
02:20As we scroll down, we see only two events here, this one, October 21st and November 24th.
02:25This could be done in a view with different fields for the title and the
02:29logo here, and so on.
02:32Then again, it might not be, and one hint that I have that it might not be is
02:35that the titles aren't clickable.
02:38Now that can be done in views, but usually people leave it in the default, so
02:41that when you click the title, it goes to a node.
02:43Perhaps the reason they're doing this is because it leads to another company's
02:47property, and if we click on Paris Games Week, we see that it actually goes to
02:50another site, and we get a warning telling us that, let's cancel out of that.
02:56Finally, let's go to Community and Awards.
03:00Once again, we have a very good-looking page and this might or might not be done with a view.
03:06It would be very good to do in a view, because as we add a new award, all we
03:10have to do is create a node that contains it, and then the view automatically
03:13adds it to this list.
03:14Again, we can't click on the title, and in fact, there is nothing that we can
03:18click on in most of these.
03:19So that tells me maybe it's not a view, but maybe it is.
03:22That's something I'll tell you about as we go through the course.
03:25Although it focuses on doing these data collections, sometimes it makes more
03:28sense to just do things in a standard node.
03:31Now I don't know about you, but I always find good graphic design intimidating.
03:36I know I don't have the skills to pull all of this together by myself, but
03:40here's the great thing.
03:41After having spent a bit of time deconstructing how the data structure probably
03:45works, I know that I have what it takes to team up with a designer and an
03:49implementation specialist to make a site that's this good.
03:53Professional quality sites like this are usually a team effort and it's
03:56gratifying to understand enough about the data portion to know that you could be
04:00a valuable part of that team.
Collapse this transcript
An organization with hyperlocal branches
00:00Finally, we come to our fourth example of data reporting and visualization,
00:04the American Red Cross.
00:06I chose this one as something to aspire to.
00:09The other three examples are all possible based on the knowledge you get in this core.
00:13This one takes it a little bit further to a very good effect;
00:16you'll find it at redcrossblood.org.
00:20The first thing I'll do here is to enter my local zip code.
00:27Let's talk about the purpose of this site.
00:29It's to encourage and facilitate blood donations.
00:32This is a hyper local activity.
00:34I am more likely to donate blood if I can do so without going far out of my way.
00:39So I entered my ZIP code and I come to this hyper local page.
00:42It shows a calendar of upcoming blood drives near me.
00:45So I know that if I want to do it soon, because I'm going on vacation or after a
00:49certain date, I can see the ones that are coming up.
00:52I also see at the bottom a map which shows exactly the same information.
00:56Once again, we have one node serving many views.
01:00When I click down at the bottom for find More Blood Drives near 44074, I see yet
01:06another view, and this one shows a lot more information.
01:10It shows Distance, as well as the Date and Time and so on, and it also has some
01:14nice little JavaScript here, so when I click See Map, it actually expands to
01:19show me that, and the same is true with Get Directions.
01:22This is the sort of thing for which you'll need some custom programming.
01:26You can hear how to do that in some of the courses about JavaScript and
01:29jQuery on lynda.com.
01:31You'll notice that this site actually remembered where I was, 44074, and then it
01:36looks within 25 miles.
01:38I can start a new search if I want with additional criteria.
01:43This actually can be done within views by using something called Exposed Filters
01:48as you'll hear about later in the course.
01:51Let's go back to our front page and tell it to forget our location, so that we
01:56get that map back again.
01:58If we click that map, we go to a map of the entire country broken up into
02:02regions where the Red Cross is active.
02:04You'll notice as I move my mouse over them, it selects what the regions are, and
02:07then if I were to click through, it gives me more information about that region.
02:11I should mention, this isn't done in Drupal.
02:14This integrates a Flash animation.
02:16So you can see that you can mix up your Drupal stuff with stuff that comes
02:19from other programs.
02:21Now you might be discouraged to learn that you'd need custom programming to
02:24do what you saw here.
02:26But that's one of the beauties of using an open-source platform like Drupal or
02:30for that matter Joomla! Or WordPress.
02:32They have highly accessible programming interfaces.
02:35So no matter what kind of data reporting and visualization you see online,
02:39they can handle it.
02:40Although you might have to go a little outside of the normal way of doing
02:43things to make it happen.
Collapse this transcript
2. Mastering Drupal's Data-Storage Model
Planning your site's data structure
00:00I am going to show you different ways that you can split up data that you already have.
00:04The way you split it up, defines how much work it takes to get the data in but
00:09it also defines how much you can get out of the data later.
00:12The examples we will use are only for this video.
00:15We are going to start with a fresh installation of Drupal right after we
00:18are done with this.
00:19So don't worry if your site doesn't look like this.
00:21We are not going to continue on with it during the course.
00:23I have already put some information into the site from the exercise files.
00:28If you have them you can do the same, using information from the video using
00:32the exercise files.
00:33I have set this up so that we see the same information in three different ways.
00:37First, in what I call a flat format, where you have the name then just all of
00:42the other information.
00:44Then we have it split out a little bit more so we have the name, separate from
00:47the Home address, from the Office address and then from the Office phone.
00:52The third version breaks it out even further.
00:55We have the First name, Last name and so forth.
00:58Each of these three methods has its advantages and disadvantages.
01:02And this video, is mostly to talk about what they are so you can plan your own
01:05site a little bit better.
01:08When we look at this flat format, it's very easy.
01:10We have all of the information there in one place.
01:13However, there's no way to sort by let's say last name or first name.
01:17You just have the information as it is.
01:19Unfortunately, you might have existing information already in your company or
01:23organization and you have to massage it a little bit in order to separate which
01:27the home address is and the office address and so forth.
01:31If we go to Employees with addresses, this is a little bit better and in fact,
01:35it is useful information now.
01:37But again, since we haven't split out the names into first name and last name,
01:41we can't sort based on only the last name.
01:45However, the advantage of an intermediate step like this is that it's fairly
01:49simple to read and understand.
01:51In this version, we have split out the bits of information quite a bit more but
01:55we could still go even further if we wanted.
01:57For example, we could split out the number of the street from the street itself.
02:02And so would have to ask ourselves, is that really useful to us or would it
02:06just mean that we're going to have difficulty when we start entering this
02:10information, because the more fields you have the more fields you have to fill out.
02:14Now in our application since this is an Employee directory, it's not really so
02:18useful for us to sort, for example, on the street number.
02:22But if we were the county assessor, we might find that more useful.
02:25We might want to see who is between street number 20 and 40 on East Lorain Street.
02:31One nice thing about Drupal is the way that we created these tables is the same.
02:36It's actually quite simple once you get into using views as you will throughout
02:40the rest of this course.
02:41Another nice thing about it, is that sorting comes built-in.
02:45So no matter how you split up your data, you can then sort it however you like.
02:49For example, you could sort by city or by state or even by Extension in the
02:55company phone system.
02:57So how much detail do you need for your data?
03:00I am afraid I can't answer that.
03:02You will have to balance the amount of work it takes to enter the data, along
03:06with your ability to keep it all straight, against what you hope to get out of
03:10it, because once more the more fields you add the more you have to fill in.
03:14You might also have to deal with data that you already have and measure how hard
03:18it would be to split it up the way you want before importing it.
03:21In general, the more detailed the data, the better.
03:25You can always combine it later into useful formats using views, as I will show
03:28you later in this course.
Collapse this transcript
Creating record templates
00:00In the last video, I showed you a few ways to break up an employee record.
00:04For example, we separated out the city and state fields from the address.
00:08What I didn't show you is how to do that in Drupal.
00:12This is a subject that I go into in depth in the lynda.com series of "Drupal 7
00:16Essential Training".
00:17But it's so important to what you will be doing in this course that I would like
00:20to review it quickly.
00:22You probably know that a complete piece of information is called a record and database talk.
00:27In Drupal, it's called a node.
00:29Nodes are modeled after content types, which are a collection of fields.
00:33It's a lot easier to understand if I show it.
00:36I have here a fresh installation of Drupal.
00:38By default, it comes with two content types.
00:41We see that if we go up to Add content, there is the Article and the Basic page.
00:46If we click Basic page, we see that each node is broken down into fields.
00:51In this case, there are only two, Title and Body.
00:55As I say, these are modeled after content types.
00:58You see those by going up to Structure and Content types.
01:02And there we see the two that we just saw a minute ago, Article and Basic page.
01:07Each of these is a sort of template for the records that you'll create.
01:11Let's Add a third template or a third content type.
01:14We know that we want an employee directory, so we'll start with that.
01:17We will go to Add content type and call it Employee.
01:21We don't need a Description and I will make a few changes down here.
01:25Instead of title, I am going to say Employee ID number.
01:30We don't want any Commenting for this so I will say Hidden.
01:33And I'll remove the author and date information which shows up in the Display settings.
01:38It doesn't really matter when we create a record or who created it.
01:42Finally, we say Save and add fields.
01:45In this case, I don't actually need a Body field.
01:48My employee directory will be very simple.
01:50There will be name, address and that sort of thing.
01:53A Body field is usually what you have for a description but I can just delete it if I want.
01:58The one part that you can't delete is this title.
02:01That's essential to each node in Drupal.
02:03Now, I am going to start Adding new fields.
02:06I am going to call this First name.
02:09You also have to put in a machine understandable name which is all in lower case
02:13with underscores, first_name, no spaces and this is just going to be Text.
02:19I'll Save that and I am asked a few more questions about it.
02:22How long can it be?
02:23Sure 255 characters, that should cover everybody and a few more.
02:28One thing I'm going to do is Require this.
02:30I will assume that everybody who works for the company has a first name, and
02:34then we can leave everything else as it is.
02:37And Save the settings.
02:38I will do the same thing with last name.
02:48And I will Require it as well.
02:51And Save and also with Job.
03:01That's also Required everybody in my company has a job.
03:04And now I am going to Add something else.
03:07It's a little bit different.
03:09It's a picture of each employee.
03:11I will call this Employeephoto and instead of Text it will be an Image.
03:19And we have no options here simply an Image. Go down and Save.
03:26Here because we are using an Image instead of Text, we have a different set of options.
03:30In this case, we can add a Default image in case we don't have a picture of the person.
03:34I happen to have one of those in the exercise files, so I will click Browse, and
03:41then we Upload and Save.
03:44Continuing down, we see that there are many more options.
03:47I am just going to leave them the way they are and click Save.
03:51The last thing I'm going to do is I am to change this Last name to family name.
03:55Let's say, for example, that we have people who come from countries where the
03:59family name comes first.
04:00I want to be friendly to them so I will change it to family name just to show
04:03you also that it's possible to make changes after you start.
04:07To do that, I go over to Edit and I change the Label.
04:13Scroll down to the bottom and Save.
04:17Now I also want to point out, that you can't change the machine name.
04:20That's going to remain as field_last_ name, which could cause confusion later.
04:26So be careful when you set up your site in the first place.
04:29And you might even have to delete fields and re-create them at some later time
04:33if you get into a problem.
04:34Generally speaking though, I found that I haven't had to do that as long as you
04:38plan well in advance.
04:40So now, we have our content type setup.
04:43What good does that do us?
04:44Well, we can start adding employees, to do that, go up to Add content and Employee.
04:51And I'll start adding this employee named Dani Smith.
04:54She is Employee 713.
04:56First name is Dani Smith and she is our Chief Financial Officer.
05:03And let's find her photo. There it is.
05:06You can tell she is a Chief Financial Officer.
05:08She graduated from college. And Upload.
05:13As we scroll down you will notice that the Comment settings are Closed just as
05:16we set them up in the content type.
05:18We click Save and there it is.
05:21Her name, her photo, and up here was her job.
05:25That gives you an introduction to fields, nodes and content types.
05:28They are the basic building blocks of information in Drupal, so make sure you're
05:32comfortable with them.
05:33If not, check out the section "Extending Content in the Drupal 7
05:37Essential Training Course".
Collapse this transcript
Understanding Drupal 7's data-template model (entities)
00:00You already know a fair amount about data in Drupal.
00:04To recap, you define data models using something called content types.
00:08And you can see a list of those by clicking Structure and then clicking Content types.
00:14Here we see the Article and Basic page that come with Drupal by default, as well
00:18as the Employee content type that we created.
00:22If you click Manage fields, you can see that each content type comprises a bunch
00:26of fields, including several that we added in the last video.
00:30Content types form templates for nodes, which you then create by clicking Add
00:34content and here we see the same fields.
00:37But as it happens, the model that you just saw goes well beyond content types and nodes.
00:42You can also create templates for people, comments and taxonomies.
00:47That might be a little confusing right now but don't worry.
00:50It's easier to show than to tell.
00:52We will start with people.
00:53And we go up there by clicking People.
00:55If we look at any one of these at the moment we only have one user myself
01:00admin and click Edit.
01:03We cane see that it's a group of fields, the Username, password, email
01:06address, and so on.
01:07Some of these are built-in.
01:09You can't add or remove them because they're essential to Drupal's configuration
01:12and the way that it works.
01:14But you can add fields to that.
01:16I can show you that by going up to Configuration and Account settings.
01:21This Setting screen which you see in the tab up here is very much like the edit
01:25screen for a content type.
01:26You have some control over basic information.
01:29Otherwise you can see the two screens are quite different.
01:32Where Content types and Account settings are the same however, is that you
01:36can add fields to both.
01:37You do that by clicking Manage Fields.
01:39I am going to Add a field here.
01:41It will say what committees that an individual person is on.
01:45Let me call Committees and it'll be a List of Text items.
01:54And we will just leave it as Select list and Save.
01:57As usual, there are a whole bunch of options that we could enter for
02:00that particular field.
02:01I am going to allow only a few values.
02:08These are the committees that I want people to be able to join.
02:11I will go down and Save field settings.
02:13And then I have some additional settings that I can make.
02:15I am going to Display this on user registration forms.
02:19That means that when people join the system, they can say what committees they are on.
02:23And I will scroll down to the bottom and Save settings.
02:26We can see the effect that had by looking at our own user profile, go up to Hello admin.
02:31Remember we are admin and Edit.
02:34As we scroll down, we now see that Committee selection list right here.
02:39And I will say that I want to be on the Hiring Committee and Save.
02:42If we go back to that Account Settings, again we click Configuration and Account settings.
02:48You can go back and edit that field if we want.
02:51For example, I can change how many values it allows.
02:55I am going to allow people to join as many committees as they want, scroll down,
02:58Save settings then go back to our profile to see that.
03:02When I scroll down, I can now Command+ Click or Ctrl+Click on Windows to select
03:08as many as I want, just as expected.
03:10As I said, there's a similar interface for both taxonomies and comments.
03:14I will just quickly show you the taxonomies one.
03:16To get there click Structure and Taxonomy.
03:20We already have one Vocabulary in here called Tags.
03:24If I edit that vocabulary, we see the same Manage Fields and Manage Display tabs up here.
03:29So we could actually keep adding fields to Taxonomies in very much the same way.
03:34So you see how you can store data in any of these four things which are called Entities.
03:39That raises a question.
03:40Why not build our employee directory using people instead of nodes?
03:45That's really an architectural decision and it's full of subtleties that you
03:48will start to learn after you start spending time with people and nodes and
03:52taxonomies and so forth.
03:53I'm going to use nodes throughout this course.
03:56But you could build it by adding fields to people.
03:59That way, each employee could sign in and manage their own records more easily.
04:02I'm doing it in more of an administrator focused way and I want the
04:06administrator to be able to control all of the nodes without the employees being
04:11able to control them.
04:12The point is that Drupal is very flexible and how it stores data.
04:16That's good in the long term, but I know it can be a little confusing when you
04:20first come across it. Don't worry.
04:22I'll show you all about how the system of entities works, as we go through
04:26the course.
Collapse this transcript
Creating categories using two methods
00:00Drupal offers a few different ways of creating categories, although, most people
00:04only notice the most common one, which is called Taxonomy.
00:07I'll show you how to create vocabularies within a taxonomy but I will also show
00:11you another one using list fields.
00:14We will start with taxonomy.
00:16Drupal actually comes with a set of categories installed in taxonomy and you see
00:20it when you add an Article.
00:21Go up to Add content and Article.
00:24Let's say that we were to say Apple is the Title here and the Tag we could
00:28add to it is fruit.
00:30And we are just going to go down to the bottom here and Save it.
00:33This is just for demonstration purposes and I will later go back and delete this node.
00:37Now you see when we look at this node, there's our Title and we see fruit here.
00:43If we had entered any other fruit when we clicked on this link, would see a full
00:47list of all of them.
00:48But where is that information stored.
00:50You can see that by going up to Structure and Taxonomy.
00:54It goes into this vocabulary called Tags.
00:58We can see that by clicking list terms and there is our fruit term.
01:02And again if we click that we will see Apple again.
01:04You get the sense of how this collect things of similar type.
01:07I am just going to go back and delete that Apple node. And it's done.
01:17Now we're making an employee directory for our Olive Oil company.
01:20I am going to show you how to use taxonomies to add a vocabulary, that shows
01:24which department an employee works in.
01:26To do that, I will go up to Structure and Taxonomy again.
01:30And Add vocabulary.
01:31I will call it Department and for Descriptions simply Employee's group.
01:39You don't actually need to enter anything into the description but I will and click Save.
01:43Now you might ask.
01:44What good does that to me?
01:46Remember, we already created a content type called Employee.
01:50You can categorize those employees by adding this categorization field to that content type.
01:56To do that, we go up to Structure and Content types then we are going to Manage
02:01the fields connected with employee.
02:03We will Add a new field called Department.
02:10And the type will be a Term reference.
02:12That's how you connect to taxonomy fields.
02:14It will be a Select list and Save.
02:18Then you have a number of other settings.
02:19One of them being which vocabulary do you want to connect with?
02:22We will stay with Department of course.
02:24Save field settings, scroll through here see what else I want to do.
02:29Yeah I only want them to belong to one department so I will say Save.
02:33Now when we go back and add an employee, we see that field.
02:36I'll show you that by going to Add content and Employee.
02:41This employee is going to be number 01174.
02:45Name is Jim Thompson and the Job is Olive picker.
02:53I have a photo of this Employee in my exercise files so I will go there and
02:56there he is Jim Thompson, Olive picker extraordinaire.
03:01And there we see our Department.
03:03Now we haven't actually added any departments yet.
03:05I am going to go back and Save.
03:07And then go up to my Structure and back to my Taxonomy.
03:12And in Department I now have to add terms.
03:14So I am going to say Field is one term, Back office is another one, Processing
03:27might be another one and so forth.
03:30There is a number of ways that you can add terms to Taxonomies and you can learn
03:34those in Drupal 7 Essential Training.
03:36But let's go back and take a look at our content.
03:38Go up to Content, there is Jim Thompson I remember was 1174 and there he is.
03:43And now when we Edit and go back down there, we can select Field and Save.
03:49And as I pointed out with other Taxonomy fields, if we were to click on Field
03:53here, would see everybody who worked in that department.
03:56Of course right now that's only poor Jim.
03:58So that's how you create categories using the Taxonomy feature.
04:02Now I am going to delete that field and use a list fields instead.
04:06So I'm going to go to my Content type, Manage Fields and delete.
04:11And when I do this, it's going to delete everything that was in that field.
04:16That's okay because were going to do it a different way.
04:18I will Add another field.
04:19I am going to call this Department and this time I will say it's a List
04:25field containing text.
04:27Again, I will say Select list and this time when I continue on, I am allowed to
04:32say which values I want at this point.
04:35In other words, it's not stored in that separate Taxonomy area.
04:38It's specific to this field.
04:39I am going to Add once again Field, Back office, Front office and Hospitality,
04:49Save field settings.
04:50We have some other options here.
04:52I am going to leave the default as None, so that people can only belong to one
04:56Department and Save.
04:58Now if we go back and take a look, take a look at any one of these Employees and Edit them.
05:07We see something very similar so from the front end it actually looks quite the same.
05:12But from the back end, there is some subtle differences between the two.
05:15And just to keep the site clean, I am going to go back and delete that
05:19Taxonomy we created since it's redundant to the list that we have, edit the
05:23vocabulary and Delete.
05:26So, there are two ways to create categories in Drupal.
05:29There is actually another one using reference fields.
05:32I will show you that in the video connecting two fields using references, which
05:35is later in this course.
05:36But I'm going to stick with this list-based system of categorization.
05:41It has two downsides.
05:42First you can't add new terms as easily as you can with Taxonomies.
05:47Second, you don't get those clickable links that I showed you with Taxonomies,
05:50the ones that lead to pages of records in the same category.
05:54But I found that lists of this sort are easier to work interviews and that's
05:59what we are going to be doing with the site later on in the course.
06:03There are subtle differences between Taxonomies and Lists.
06:06The more you work with Drupal and with both systems, the more you'll understand
06:10which to use when it's time to categorize content.
Collapse this transcript
Creating unusual field types
00:00In previous videos, you saw how to add fields to entities.
00:04In our case, we added images, categories, and text fields to fill out
00:08our employee records.
00:10And if we click on any of these records, you see exactly how that works.
00:13We have the Name, the Job, a Photo, in this case a very large photo, and a Department.
00:18Because this course is so data-focused, I want to briefly go over some of the
00:22other kinds of fields that are available either in Drupal Core or through add-on modules.
00:28By the way, I added a few more employees to our site just to fill it out.
00:32You can do so as well if you have this course's exercise files, or of course,
00:36you can use your own data if you like.
00:38Now we're going to go and add some fields.
00:40I go up to Structure and Content types and we'll be adding them to the Employee
00:45content type by clicking manage fields.
00:47I'm going to show you some of the different types of fields that you can add and
00:52I'll do this by adding a temporary field which I'll simply call temp.
00:55We'll be deleting this later.
00:59The first one I'll show you is called Boolean.
01:02Boolean simply means that something can be on or off.
01:04I'll save it and indeed it gives me choices where do I want the on value and off value to be.
01:09I'll just say on and off.
01:14As I scroll down, I see exactly what it's going to look like when it shows up on
01:18the node form and I'll leave it as it is and Save settings.
01:22Now if I add some employee content, we'll see how that looks.
01:25I'll do that by Ctrl+Clicking on Add content.
01:28If you're on Mac, you can Command+ Click in order to add this new tab.
01:32We'll add an Employee, scroll down, and there it is.
01:35Exactly as we expected.
01:38Now let's go back and delete that temp field, because I'm going to reuse that
01:41name to show you some other types of fields.
01:44Once again, I'll add temp and take a look at some of the different number type
01:50fields before going on.
01:52We have Decimal, Float which is a floating-point, which if you know advanced math;
01:57it defines decimal types, Integer, which is only whole numbers, and so on.
02:02We also have a File type.
02:04This is very similar to the Image type, except it doesn't display the file itself.
02:08You can use this, for example, for Microsoft Word documents or Adobe PDFs
02:13or anything you like.
02:14There are several types of list;
02:16we already have some experience with those.
02:18Then we have this Long text and Long text and summary.
02:22Long text is simply a text field that can be multiple rows.
02:25But I want to go into Long text and summary because it's a little bit unusual.
02:28I'll select that, we see text area with a summary is the only choice.
02:33So I'll go ahead and click Save.
02:35We continue on to see all of the options, scroll down a little bit, and you can
02:41set how many rows show up.
02:42It's quite a large one.
02:43I'm just going to change this back to 5 rows, so it's a slightly smaller input area.
02:48I'll check Summary input and you'll understand what this means when we
02:51actually see it on our form.
02:53Scroll down to the bottom and Save settings.
02:55Once again, I'm going to Add content, and go over to see how that content gets added.
03:00I'll click Employee.
03:02We have our usual fields as we expect.
03:04And then down at the bottom, we have this temp field.
03:07And as you can see, you can type whatever you want in there.
03:10The thing about this Edit summary, this is what we got by checking that box.
03:14We can have a different summary from the contents itself.
03:17And you might ask, well, where exactly does that show up?
03:20Well, when you set up a collection of nodes, when you want to view a collection
03:24of pieces of information, you can choose whether to show the summary or the full body text.
03:31So let's say that you have a collection of articles out of a newspaper and
03:34they're all 600 words long.
03:36But when you show those on the front page of your newspaper, you only want have
03:39a one-sentence summary.
03:40That's what this summary is good for.
03:42It actually ties a short version of whatever the content is to the content itself.
03:48I'm just going to get out of this by closing this window and once again, I'm
03:52going to delete that temp field.
03:56That gives us a very quick tour of the field types that are available in Drupal
04:00without adding any other modules.
04:02But there are many, many more available, and you can see that by going to
04:06drupal.org/project/modules.
04:11Once there, as always, you want to filter by compatibility.
04:14Since we're using Drupal 7, we have to filter by that.
04:17But then there's also a module category called Fields, when we search on that,
04:22and you can see that there's over a hundred types of fields that you can add
04:26to your Drupal site.
04:27I'm going to actually add one to our site called Link.
04:30So I'll click through on that, scroll down and download it as usual by copying
04:38the link, going back to my site, going up to Modules, installing the new module,
04:45pasting and install. We'll enable it.
04:51I'll scroll down on the page until I find Link.
04:54There it is in the Fields group, all the way down to the bottom and
04:57Save configuration.
05:00Now if we go back and edit that content type again by clicking Structure and
05:04Content types, and then manage fields, next to Employee, we see that we can add the Link type.
05:11I'm going to go ahead and do that, give each employee a way to show off their homepage.
05:16We'll call this Homepage, it'll be a Link, and then we go down and Save.
05:25We continue clicking through until we have various options, and I'll leave the
05:29title as Homepage, scroll down.
05:32We have various options as to how that link is shown.
05:35Do we want it to have an Optional title, a Static title, I'm going to say that
05:38that everyone is going to be called Homepage, and then scroll to the bottom,
05:44pass the other options, and Save settings.
05:47Now as you'll see, when we add content that's an employee, we have an option of
05:54putting in their homepage.
05:55I'm going to go back and edit one of our existing employees and give them a homepage.
05:59Let's just choose this one.
06:01Dani Smith's homepage is lynda.com.
06:07Scroll down and Save.
06:09When we look at that person, we see there is our static title Homepage, and by
06:14clicking on it, of course we would go to whatever that site is.
06:18Now going back to drupal.org, as I said, there are many, many, many types of
06:23fields that you can add.
06:24And in fact, later on in this course, we're going to look in greater detail at
06:28two kinds in particular, a field that's good for date-based data, for calendars
06:33and such, and one that's good for locational data, such as maps.
Collapse this transcript
Reusing and grouping fields
00:00I'd like to show you two little tricks that are useful when you're building
00:03a data-driven site.
00:04Neither of these really affect how information is stored or later accessed when
00:09you start displaying it with views, but they do affect the forms people see when
00:13they enter data and can cut down on some administrative hassles as well.
00:17I should mention before we start that I already added a few extra things to this
00:22Tags vocabulary down here under Taxonomy.
00:25We go into Tags and list terms, we now see we have Outreach, Softball, and Tasting.
00:31I just added them for demonstration purposes, you can add them or not at your choice.
00:35They won't make a difference in how your site functions later in the course. On with the show:
00:39The first trick lets you reuse one field in more than one content type.
00:43I'll show you what I mean.
00:44We'll go up and Add content and add an Article.
00:49And you'll notice that there's a Tags field here.
00:51If I start to type in Softball, it automatically selects it because it knows
00:55that there's an item in that Taxonomy called Softball.
00:58If I go up and take a look at the content type that creates this, the Article
01:01content type, go up to Structure and Content types and Articles, manage fields,
01:08we see that the Tags field is right there with an Autocomplete widget.
01:12I'm going to reuse that Tags field in my Employee Content type.
01:16To do that, we'll go back to our Content types;
01:18I could click up here and go Structure and Content types and so forth.
01:21One easier way to do it is to just look at this breadcrumb here and go
01:24backward to Content types.
01:27And then I'll manage fields in my Employee Content type.
01:30Instead of adding a new field, I'm actually going to select one down here.
01:34And there it is, our Tags.
01:37I'll call that Tags as well.
01:39And instead of having it as an Autocomplete, I'll have it as a Select list,
01:43Save, and then I have my usual options to choose.
01:48I'll just skip over all of these and Save settings.
01:52Now when I add an employee by going to Add content and Employee, indeed I
01:58have the Tags field.
01:59And you'll notice, even though it contains the same content, that is, it
02:02contains the same choices in vocabulary, they're accessed in a different way.
02:06And indeed, down at the bottom we have our Tags field here.
02:10The only difference is the widget.
02:11Instead of being that Autocomplete widget, we can click and Command+Click,
02:15Ctrl+Click to select multiple ones and so forth.
02:19But I don't really want to have that in the Employee Content type, so I'll go
02:23up to Structure and Content types and down to Employee where I manage fields
02:29and delete that field.
02:30Now you'll notice it only deletes the content in this field in this content type.
02:36So when I click Delete, if I go back now to the other content type that had it,
02:40that was the Article Content type, it's still there.
02:44We only removed it from the one content type.
02:47So that's how you reuse fields and you'll find that handy later on.
02:50For example, let's say you want to create a page that shows everything on the
02:53site related to the company softball team.
02:56You'd show everything tagged with softball regardless of whether that tag was on
03:00an employee or on an article.
03:02You could then further configure the page to show a roster of the employees who
03:06are on the team alongside all the articles about it.
03:09All that by simply selecting the one softball tag that bridges both content types.
03:14Now let's move on to the other trick I'd like to show you about field grouping.
03:19To make this happen, you have to download and install an extra module.
03:23That module is at drupal. org/project/field_group.
03:27I'll scroll down and install it in the usual way.
03:30I copy the link location for the .gz file, go back to my site, click Modules,
03:39Install the module, paste its URL, and click Install.
03:44Then as usual, I enable it.
03:47I know that it's not in the Core group, so I can make that smaller by clicking
03:50its link here, scroll down a little bit and there it is, Fieldgroup.
03:55Select it, go to the bottom, and Save configuration.
03:58You'll see this when we go back and manage the fields within a content type.
04:02To do that, I click Structure>Content types and I'm going to manage the fields
04:07once again in our Employee Content type.
04:11I'm going to add a new group and you'll see a new option down here under Add new
04:14field and Add existing field called Add new group.
04:18I'll call it Personal;
04:19this will be for personal information.
04:23And the option I'd use is Fieldset.
04:25Interestingly, you can do all sorts of other interesting effects using this group.
04:30You could have it show up in vertical tabs much like at the bottom of a node or
04:33horizontal tabs and so forth.
04:35I recommend that you check out all of these, they're very interesting.
04:38But for now, I'm just going to go down and Save.
04:43I'll move that up to the top, and then I'm going to drag some fields into it so
04:48that it all gets grouped into one place.
04:51I think the First name should go in there and the Family name.
04:54And how about the Employee photo along with their Homepage, since it is
04:59their personal homepage?
05:01Scroll down to the bottom and you'll notice from the little asterisks, that
05:04means you have to remember to save otherwise you'll lose that ordering.
05:08Now let's see how that looks when we actually add an employee.
05:12Go up to Add content and I'll open that in a new tab.
05:15On Windows, I do that by holding Ctrl and on Mac, by holding Command as I click.
05:21Add an Employee and you see up here that field group.
05:25We can collapse if we want to make it a little bit easier to show and in fact,
05:29there were some options back on that earlier page that showed that you can have
05:32it start out as collapsed or make it so that it can't be collapsed at all.
05:37Once again, I just want to show you what those options are.
05:39I go back to Employee here and if I go up to this little widget, I can see all
05:44of my options and I can change those at any time.
05:47Again, it's collapsible or not, you can make it so that it's open.
05:51If you're a designer and you're good with CSS, you can also add extra CSS
05:55classes to it so the field group can really look anyway that you want.
06:00That's pretty tantalizing, isn't it?
06:02And some of the other options such as vertical tabs are great for organizing
06:05input forms as our horizontal tabs and accordion items which work similarly.
06:10They're all well worth exploring, especially on sites where you expect to do a
06:14lot of manual data input.
06:16A few minutes organizing the fields is well-invested, especially if someone
06:20ultimately will have to enter thousands or even tens of thousands of records.
Collapse this transcript
Looking at Drupal's database
00:00To be honest, you don't need to watch this video to create a great data-driven web site.
00:05In fact, we won't look at Core Drupal at all.
00:08We're going to dig below Drupal, into the database it uses to store all your
00:12site's data and settings.
00:14I'm going to do this because sometimes, not often, mind you, but sometimes it's
00:19most convenient to grab a quick and dirty export directly from the database.
00:23And even if you never have to do that, it's instructive to see how Drupal works
00:27with data behind the scenes.
00:29So let's take a look.
00:30We're running Acquia Dev Desktop which has a button on it that lets us
00:33manage our database.
00:35If you're using Drupal on a web host, there's a good chance that they also use
00:39phpMyAdmin, the same program that Acquia Dev Desktop does.
00:43So while the interface you see might not be exactly the same, the same concepts
00:47should be true for you.
00:49phpMyAdmin can store multiple databases.
00:52The one that we're using is called twotrees.
00:54You might remember that from when we installed the site in the first place.
00:58You can click on twotrees to see a list of tables, or if you prefer, go back to
01:03the front page and click on this Databases link.
01:06Here you have some additional options. But in either case, it leads to the same place.
01:11As we scroll through these tables, some of the names will look familiar to you.
01:15For example, field_data_field_first_name.
01:20As you might guess, when I click that, it shows us all of the data that goes
01:24with the first name field that we put into our web site.
01:27We can further look at any individual row by clicking this little Pencil icon,
01:31although to be honest, now we're digging very, very deeply into the database itself.
01:37So I'm just going to go back to our first_name table.
01:40If you want to export this, you click the Export tab up here.
01:45Then you have a lot of different options.
01:46I'll simply scroll to the bottom. I'll simply scroll to the bottom,
01:50And instead of saving it as a file, I'm going to show you what it looks like on the screen.
01:54I click Go and there it is.
01:57These are the instructions to the database program on how to recreate the
02:01database that's behind your Drupal web site.
02:04And there are all the values.
02:06So that's how you can get data out of a Drupal site, even if you don't
02:10have Drupal running.
02:11That also shows why it's not enough simply to secure Drupal if you want to
02:15keep your data safe;
02:17you also have to make the database secure.
02:20lynda.com has a few MySQL courses that can help you with that.
02:23And for immediate help, scroll back up to the top and click this little Help balloon.
02:29I find phpMyAdmin to be extremely useful, and in fact, that's how I created the
02:33exercise files for this course.
02:35If you'd like to learn how to import those exercise files, see the video
02:39"Using the exercise files."
02:40I want to mention one other method of getting your database in and out of
02:44Drupal; however, this requires that you already have Drupal running.
02:48To show it, I'll go to my site where I've already installed the module
02:51called Backup and Migrate.
02:53You can get it from drupal.org/project/backup_migrate.
02:59But I'll just go back to my site where I have it installed.
03:02You click Configuration, and Backup and Migrate.
03:06This is a different view of the same information.
03:09If we click the advanced backup page, you'll see that in fact we can select
03:14which tables to include in our backup and which ones to exclude.
03:17Very often people will exclude the caches because it's a lot of stuff that's
03:21only held temporarily and can really bloat your database quite a bit.
03:25Again, you might never need the information from this video,
03:28but the fact is, Drupal doesn't exist in a vacuum.
03:31You often need to make it work with non- native data sources, or you have to get
03:36data in or out using the SQL language.
03:38I can't teach you that.
03:39Again, it's a very big subject, and there are other lynda.com courses that do.
03:44But knowing just a little about the backend database can speed up your work and
03:48get you out of a lot of trouble.
Collapse this transcript
Migrating custom fields from Drupal 6
00:00I'm going to guess that some of you watching this course already have
00:03experience with Drupal 6.
00:05Maybe you have a Drupal 6 site already built, and you want to see how to move it
00:09from the old data storage model to Drupal 7's new one.
00:12If so, this video is for you.
00:14It'll be quite different from all the others in this course, because we'll
00:18start off with the same employee database we've been seeing, but this time in a Drupal 6 site.
00:23I'll then show you what it looks like after a standard upgrade to Drupal 7, but
00:27you'll notice that none of our custom fields appear. But don't worry;
00:30we'll finally do some special procedures to bring everything up to date.
00:35There are no exercise files for this video, because you'd have to go through
00:38quite a lot of trouble to follow along at home.
00:40But it should be clear just from watching.
00:43First, here's our Drupal 6 site and you'll notice it looks sort of familiar.
00:47When you click on a title, we get the data for any one of our employees and so forth.
00:52We've simplified it a little bit by adding only a few fields.
00:55Now here's the Drupal 7 equivalent.
00:58But if you click on one of these titles, you'll see that actually there are no
01:02other fields, it's only the title. Don't worry;
01:05we'll be exposing all the other data.
01:06It did come over in the migration, but it's just not showing up yet, because
01:10there's different data storage models between Drupal 6 and Drupal 7.
01:15Incidentally, the way that I brought this over was I simply created a brand-new
01:19copy of Drupal 7 and then imported the Drupal 6 database.
01:23Then I ran Drupal's update.php script.
01:26In order to bring it up to date, we're going to go up to Structure, and Content types.
01:31Then we'll take a look at our Employee Content type and manage fields.
01:35And indeed we don't have any of the fields that we expect.
01:38We have only the title, none of the custom ones that we created.
01:43In order to convert it over, we'll look at some instructions that I found on drupal.org.
01:48The location is drupal.org/ node/1144136. And there it is.
01:55The important part of this page is this Upgrade Steps.
01:59And the most crucial part of that is that you need a certain module, the CCK module.
02:04You might remember that that's how we actually got those custom fields into Drupal 6.
02:08Well, in order to do the migration, you also need it in Drupal 7. So we'll go to it.
02:13It's at drupal.org/project/cck.
02:13I'll Ctrl+Click to open that in a new tab.
02:20I scroll down, and as usual, I download the latest version.
02:24Notice that for Drupal 7 there's only a Development release.
02:28Well, you take what you can get, so I'll take the .gz file, copy its link
02:32location, go back to my site, and install it in the usual way.
02:36Click Modules, Install new module, paste, and Install, and then enable the
02:45correct parts of the module.
02:47As we scroll down on the page, we see a CCK group.
02:54It includes CCK, but also this thing, Content Migrate.
02:58That's the part that will help us, and Save configuration.
03:03The next thing to do is to go to Structure and Migrate fields.
03:08We want to migrate all of our fields, so I'll all click this check box at the
03:11top, and then click Migrate selected fields.
03:17This may take a while.
03:18Now if we go back up to our Content type by clicking Structure, Content types,
03:23and manage fields next to Employee, we see that our fields are there.
03:28If we go back to the front page of our site and we click on any one of these,
03:32we're all good once again.
03:34So those are the basic steps.
03:35There are several special cases you need to know if you're converting a
03:39complex Drupal 6 site.
03:40For example, you'll need extra modules to migrate reference fields, field-based
03:45content permissions, or field groups.
03:47The details once again are on this page on drupal.org, at
03:52drupal.org/node/1144136.
Collapse this transcript
3. Importing, Connecting, and Presenting Data
Connecting two fields using references
00:00So far the fields in our site are pretty straightforward.
00:04They contain values that you either type in or are part of a list, or are in a
00:08taxonomies vocabulary.
00:10Now we are going to get little bit fancier and start pulling in fields from
00:13other content types.
00:15Let's pretend that our olive company grows its product in a number of locations.
00:19And that the list of locations changes fairly often.
00:23We want to connect employees with the farms that they work at.
00:26And we want this list to appear as a pop-up menu.
00:29We could do that as a Taxonomy or a List field as you saw in the video, creating
00:33categories using two methods.
00:35But the way I'll show you now, using a Drupal technology called References, is more flexible.
00:41To make it work, we first have to get an extra module called references.
00:46That module is a drupal.org/project/references.
00:47I will go down and install it in the usual way.
00:55Copy its Link Location for the .gz.
00:58Go to Modules>Install new module>Paste it in and Install.
01:06Then as usual I turn it on.
01:07I will close up the Core group to get down there faster.
01:11It's not in this group either, but it is here in the Fields group.
01:15We will Enable Node Reference, References and User Reference.
01:18We actually won't be using User Reference, but it doesn't hurt to Enable it.
01:22Go down to the bottom and Save configuration.
01:25Now we will create our locations.
01:27These will be separate nodes of a content type that we will call location.
01:31To get there I will go up to Structure and Content types and Add a new
01:36one called Location.
01:39Instead of saying Title, the title will simply be called Location as well.
01:44These won't be Promoted to the front page.
01:47We don't need to see author and date information and we don't need to accept Comments.
01:52Again, this is simply showing where our people are working.
01:56Scroll to the bottom and then click Save and add fields.
01:59I could say Save content type and then click manage fields but this does
02:02exactly the same thing.
02:04We don't need a Body field so I will delete that, yep I really do want to Delete
02:08it, and we are ready.
02:10Now obviously, this is a very simple content type.
02:14The only thing it will store is the name of the Location.
02:17We will add the actual addresses later in the video:
02:20Working with Locational Data.
02:22So now we can go ahead and add a few nodes of locations.
02:26Go up to Add content and Location, first one will be Carpinteria orchard and Save.
02:34We will Add another one, Ventura orchard and Save and finally Oxnard office, and Save.
02:50Now if we go and take a look at all of our content by clicking on Content, we
02:55see all of our Location showing here by type, along with all of our Employees.
02:59If we wanted to, we could Filter by one or the other, say Show just the
03:03Employees or just the Locations, like so.
03:07But I'll leave it as it is for now by clicking Reset. So we have both.
03:11Now we'll connect the two by adding a reference field to the employee content type.
03:16To do that, go up to Structure and Content types and then click manage
03:21fields next to Employee.
03:24This field will be called Location and the type will be a Node reference.
03:30This is one of the two new things that came along with a reference module, Node
03:34reference and User reference.
03:36Instead of Autocomplete I actually want to see a list of all of the locations,
03:40so I will make it a Select list.
03:42Scroll to the bottom and Save.
03:45We have a choice to say nodes of which Content type can be referenced.
03:49Of course we are going to use the Location one and Save field settings.
03:52We will leave all these other settings alone.
03:56Scroll to the bottom and Save settings.
03:58I am going to make one more change to our group of fields.
04:02We have a personal group up here so I am going to Add a Work group for the rest of the ones.
04:11Scroll to the bottom and Save.
04:12And then I will just drag this all into place.
04:15This just makes it all look a little bit better, but it doesn't affect the
04:18functioning of the site really very much at all.
04:20There is our ID number, Job, Department, and Location.
04:25Scroll down and Save.
04:28Now let's go back to our front page and edit one of these employees.
04:31I will just pick this one at random, click Edit.
04:35As we scroll down, we see first of all we have that Work group here, and then we
04:39also have that Location.
04:41Now remember, this is not referencing Taxonomies or a List, it's referencing
04:45those three nodes that we created.
04:47Since she is a sales person, I will put her in the Oxnard office.
04:51Then scroll to the bottom and Save.
04:53As we scroll down to the bottom, of course we see, there it is Oxnard office.
04:58And if we click that link, we see details about that office if we had any,
05:02and we will later on.
05:05There are many ways references are useful when building a data driven site.
05:08Here is one example.
05:10Let's say our company has one department that handles operations and another
05:14department for human resources, the way that we set up our site, separating out
05:18locations and employees, we could give our operations department permission to
05:22easily add and remove locations, but not allow them to touch employee records,
05:27fields or taxonomies.
05:29The data structure becomes clearer as well.
05:31So your site becomes easier to understand and to maintain.
Collapse this transcript
Importing data using Feeds
00:00If you already have a set of data records you want to turn into a web site, then
00:04this video could be the most important one in the whole series, because it shows
00:08you how to import those records using a Drupal Module called Feeds.
00:12We will use an exercise file called employee-import.txt, which you have, if you
00:17received the exercise Files for this course.
00:19I have already opened it up so you can see that it has a header row which lists
00:23the different field names, and then it has the data itself.
00:27To get started, we will go back to our browser and then go to drupal.org to
00:31download the feed's Module.
00:33The URL is drupal.org/project/feeds.
00:35We will scroll down and install this in the usual way.
00:42We Copy the Link Location for the .gz file, go to our site, click Modules,
00:47Install the new module, paste in its URL and Install.
00:53Then we go and Enable the parts of the module that we want.
00:56I will get down there quickly.
00:59It's not in the Core group, not in Chaos tools but it is in Feeds.
01:03You will notice that you can't actually check the Feeds box, that's because it
01:07requires another module called Job_scheduler. That's okay;
01:11we will go and get that by opening up a new window and going to
01:15drupal.org/project/job_scheduler.
01:20And we will install that.
01:22As usual, make sure that you have the Drupal 7 version.
01:26Go back to our site, go back up to the top of our Modules page and Install it.
01:37Now when we scroll back down to the Feeds group, we see that we can turn on Feeds.
01:42I will turn on that Module which is necessary, also UI;
01:47otherwise you won't be able to see anything.
01:48We will leave Feeds Import alone for now.
01:51I will show you that a little bit later.
01:53Go down to the bottom and Save configuration.
01:56It tells us we need to enable job scheduler, sure, Continue.
01:59And now we are ready.
02:02Importing data is a two-step process.
02:04First, we set up a Feed importer.
02:07That specifies what fields are being pulled in and how they're being pulled in.
02:11Then we actually perform the Import.
02:13To get started, go up to Structure and Feed importers.
02:18We have none to begin with so we click New Importer.
02:21We will call this one Employee import and the Machine name which has to be in
02:26lowercase and no spaces, we use underscores instead.
02:29And I I'll leave the Description alone then click Create.
02:34Now we have a large page of settings.
02:36The default assume that you're working with stories that are coming in from an
02:39RSS feed on the web, so we will have to make a lot of changes to make this
02:43work with our text file.
02:44I will go through each one very quickly, but of course, you should be taking a
02:48look and making sure that it fits your particular situation.
02:52The good news is that with all these settings, this is actually quite a flexible Module.
02:56It could pull things in from the web or from files.
02:59It can process them in many different ways.
03:01We will start with the Basic settings.
03:03The Attach to content type setting, I usually leave a stand-alone form.
03:07It's a little bit complicated to explain exactly what it means to attach it to
03:11an Article or Basic page or so forth.
03:14I would just recommend you leave it alone unless you know specifically that you
03:17need something else.
03:18We are only going to be doing an import once, so I can remove this Periodic
03:22import, turn it off and save.
03:25Everything else is fine.
03:27Then we'll see the Fetcher.
03:28We are not going to be pulling things off of the web instead we will be
03:31uploading a file, so I will Select that and Save.
03:35We then change the Settings on that File Upload.
03:37We are using a text file that's fine and we're going to select it using our
03:41standard file selector so that's all good.
03:44Then we change how things are Parsed.
03:46That means, how is it going to pull this information out.
03:49It's normally expecting an RSS Feed, which has a lot of tags in it.
03:53Ours is going to be a simple comma separated value file.
03:57Actually our separators are tabs, but that fits into this group, so we
04:00say Select and Save.
04:03Going down we can change some of the CSV Settings, to say what the delimiter
04:07is, as I said, we are using Tab not Comma and we do have headers, so we leave
04:12this unchecked and Save.
04:13We are almost there I swear.
04:16Finally, we decide how exactly we are going to process these and what fields we
04:20will actually pull in.
04:21Click Change on the Processor.
04:23The next thing to change is the Processor.
04:26This determines whether you're going to import nodes, taxonomy terms or users.
04:30We are going to import nodes, so we click Save and continue down.
04:36Click Settings next to Node processor.
04:38Here you can decide whether you are going to Replace existing nodes and a few other things.
04:42The replacement typically happens if you're pulling in an RSS Feed.
04:46Let's say that a publication puts out an article and then later corrects it,
04:50this would replace the earlier one.
04:51But as I say, we're just doing a single import from a text file.
04:54So we'll leave it, Do not update any existing nodes.
04:58Text format is Plain that's fine.
05:00And then the Content type is going to be an Employee.
05:05Finally, we can say who's authoring this.
05:06I am going to say the administrator is, which is the user admin.
05:11And we'll leave those nodes on the site forever. Click Save.
05:15Now we get to one of the trickier parts.
05:17This is where you map fields in your text file to those in your Drupal site.
05:22Click Mapping to get there.
05:24To make sure that I don't misspell anything, I am going to switch over to my
05:27text file and actually copy and paste these headings.
05:31So the title, we will be mapped to the Title and you'll notice as we go through
05:35here, it now shows all of the fields that are in that Employee content type.
05:41Add that and go through the rest of the fields as well.
05:48Finally, we are ready to import, so I click Save.
05:51That takes care of the first step where we set up the importer.
05:55The second part is actually quite easy.
05:57We go to the import screen simply by going to our domain name and import.
06:03Now I will go back and close the file.
06:06Then I return to my site and perform the import.
06:09It confirms a few things, yes we want TAB Delimited.
06:12It has Headers and we select the file.
06:15Click Open and Import.
06:20And we had success. 5 imported items.
06:23We can check to make sure they're actually there by going up to our Content link
06:26up here, and indeed, there they are our 5 new Employees.
06:30If I visit any one of them, we will see that all of the fields that we
06:34originally imported are there.
06:36However, that might not be all of the fields, for example, there was no Employee
06:40photo or a Homepage.
06:41It was just the ones obviously that was in our text file.
06:45Now I have to admit that I did this a little bit the hard way, because I wanted
06:49to show you everything.
06:50If you go back to Modules and scroll down again to our Feeds group, you will
06:56notice this Feeds Import Module we left alone before, I will Enable it, go down
07:01and Save configuration.
07:03Now if we go up to Structure and Feeds importers, we see that we have
07:08two additional ones.
07:09Really all that that module gives you is these two modules as examples that you can follow.
07:15So that's the easy way to import nodes from a text file.
07:18There is one last thing I need to mention, because it drove me absolutely crazy
07:22for a couple of hours once, when I couldn't get my import to work.
07:25Make sure the records in your file have UNIX Line endings.
07:29I found that editing the file in Excel on the Mac;
07:31replace the correct kind of line endings with Mac style carriage Returns, and
07:36then the Feed simply wouldn't work. It looked fine.
07:38It just wouldn't come into my Drupal site.
07:41If for some reason, the import step of the process keeps telling you that no
07:44nodes were created, we save the file with UNIX Line endings.
07:48On Mac, that's possible with the program TextWrangler, which is available from
07:52barebones.com/products/textwrangler.
07:53For Windows, I recommend you go to wikipedia and look at the Comparison of
08:02text editors there.
08:04If you scroll down, you will see one that's specially used for part of the
08:07page, Newline support.
08:08This will tell you exactly which text editors will give you the Unix Line
08:12Feeds that you need.
08:14Finally, I want to mention that Feeds is not the only way that you can get data
08:17into your Drupal site.
08:19There are two other modules that people frequently use.
08:22The first one is Node import, which is available at
08:24drupal.org/project/node_import.
08:28The other is simply called the Migrate Module.
08:31It's a drupal.org/project/migrate.
08:34Migrate in particular is extremely flexible, but it requires some programming skill.
08:41So if you find yourself facing some sort of data import that Feeds won't handle,
08:45turn to Migrate and it will help you out.
Collapse this transcript
Changing the appearances of fields
00:00So far in our site the most visible part of the employee records is the employee
00:05IDs, which you see here as the title.
00:07Besides being ugly, that makes the data harder to manage.
00:11You can't simply skim through the page and pick out who's who.
00:14It'd be much easier if we saw names instead of numbers or names in addition to numbers.
00:19We could have set up the site where the names are in the title field, but then
00:23we wouldn't have separate fields for first and last names, which creates its
00:26own set of problems.
00:28Fortunately, we can fix this by making some simple changes to how fields
00:32display on our site.
00:34Along the way, you will gain a lot of control about field display on your site in general.
00:39To get there, we click Structure>Content types.
00:43Then instead of clicking manage fields next to Employee as we have been up till
00:46now, we click manage display.
00:49Here we see all of our fields and next to them we see whether there's a label
00:54and also what format that field is in.
00:56Before we get onto individual fields though, I want to point out this Default
01:00versus Teaser, and explain what the difference is.
01:03The Default is what you see when you go back to the front of the site and you
01:06click on any of the titles.
01:08There, it's all of the fields in one place.
01:11The Teaser on the other hand is what you see when the nodes are collected into a
01:14group, such as on the front page.
01:17If we go back to our Structure and Content type and manage display and
01:21Employees, you will see that the Teaser right now doesn't show any of
01:25our special fields.
01:26It's only showing the title by default.
01:28So let's move our First name and Family name up to that top area.
01:32Then go down and click Save.
01:35Now if we go back to our front page, we see not only the number, but also the
01:40person's First and Last name.
01:42So already it's a little bit better.
01:44But we could make it even better.
01:46We don't really need to say First name and Family name here.
01:49So we will go back to Structure and Content types and manage display on Employees.
01:55Once again we go to the Teaser and there we can simply remove the labels.
01:59We could put them in line or just hide them.
02:03As long as we are here let's take a look at the format pop-up.
02:06If this were styled text, you'd be able to show it with all of the styling
02:10stripped out or trimmed, and I'll explain what trimmed is in just a minute.
02:14Scroll down to the bottom and Save.
02:18Now if we go to our front page again, we see simply Konrad Konradovich, Jon
02:23van Horn, much better.
02:25As we go on in the course, we will continue to improve the look of this front page.
02:29However, to do so we will be using Views which is later in the course.
02:33So that's one part of the problem, but let's go a little bit further.
02:38You might remember that we have some photos down here that were kind of big.
02:41If we click on the link here, for example, that's way too big a photo.
02:46We can change how it looks in the node though.
02:48Once again we go to Structure>Content types and then manage display next to Employee.
02:54Remember we are looking at the full node, which is the default.
02:58For employee photo, you notice this little widget next to it, because it's an
03:01image and not text, it has some additional options connected to it.
03:06Instead of showing the original image, I am going to make it a
03:09medium-sized picture.
03:11You can define these styles in another part of Drupal and I'll tell you how to
03:14do that in Drupal 7 Essential Training.
03:17We will link the image to the content itself, so if somebody clicks on the
03:21image, it will actually go to that node.
03:24Click Update, scroll down to the bottom, and Save, and let's see how that did.
03:30Go back to the front page, back down to Mr. Kvitchner.
03:34Much better!
03:35Incidentally, Drupal generates those photos on the fly, so after the first time
03:40it appears it shows up faster from then on. But there's more.
03:44You can adjust field display to do quite a bit more than just change the
03:47appearance of Teasers and nodes.
03:49In fact, field display itself is kind of a misnomer.
03:53You see, changing some kind of field display, changes not how you see the
03:57fields, but also how Drupal sees them internally.
04:00In this case I am going to make it impossible to search our employee directory by name.
04:05I'll show you how it is right now.
04:08If I do a search for Hussein and Search, we find Eli Hussein, but we can change that.
04:16We go back up toward manage display link by clicking Structure, Content types,
04:21and manage display, and down at the bottom you see Custom Display Settings.
04:26Click that link to open it.
04:29Right now, there's just a Teaser showing as a Custom Display, but you can change
04:33what's in the Search index as well.
04:35Click that, go down to the bottom, and Save.
04:38Now if I select Search index up here, we see all of the fields that are searchable.
04:44I am going to take the names out of that area, put them into hidden, and then go
04:51down, and click Save.
04:54Before that hides those means, I have to go back and clear the Search index.
04:58That setting is under Configuration and Search settings.
05:03Now Drupal will re-index the entire site the next time the Cron runs.
05:08You can enforce that by clicking the cron maintenance task right here.
05:13So I'll run Cron manually by clicking on this link.
05:17Now if I go back to the front page and do a search, once again for Hussein, we can't find him.
05:23That's good.
05:24We've protected our user's privacy by changing the way that fields are
05:28displayed to Drupal.
05:30I want to go back for just a moment and explain what a trimmed summary is.
05:34You might remember under Structure and Content types and manage display I said
05:39something about the trimmed version.
05:42This really only comes into play when you have a long field.
05:45If, for example, you had a body field that it was many paragraphs long and you
05:49don't wanted to appear quite as long on your front page, Drupal will trim it
05:53down to the first paragraph more or less.
05:56That's handy, for example, you're doing a news site and you just want to tease people.
05:59You want to them a little taste of what's there, but not the whole thing.
06:03So now you've seen how to create and edit content types, add and manage
06:08fields, and move those fields around to change how they're displayed in various contexts.
06:12But the way we've changed those field displays is still very limited.
06:17You get a lot more control when you use Views, which is what I'll show you
06:21next in the course.
Collapse this transcript
4. Understanding Views
Understanding why views are useful
00:00Now that you've seen how Drupal stores and displays data, it's time to
00:04start recombining it.
00:05The way we do that is with the module you installed at the beginning of the
00:08course called Views.
00:10In case you didn't install it, do that now along with the Chaos tools
00:14module that it requires.
00:15You will find them at drupal.org/project /ctools and drupal.org/projects/views.
00:26You will also need to enable the Views and Views UI modules.
00:29We will go back to our site and click Modules and as we scroll down you will
00:33come to a Views group down toward the bottom.
00:36These are the two that you need to enable.
00:38If you've already installed C tools;
00:40that will automatically enable the parts of C tools you need as well.
00:44If you need help installing these modules, see the section about expanding a
00:47site's capabilities with modules in the Drupal 7 Essential Training Course from lynda.com.
00:53The best way to explain how Views work is to create a simple one, by way of demonstration.
00:58I'll be very brief, but don't worry;
00:59you will see all of this again in detail as we go through the rest of the course.
01:04To get there we go up to Structure and Views.
01:07I will add a new view.
01:10This view will be called Simple list of employees.
01:13It shows only employees and I'll leave all of the other settings alone.
01:19Go down and Save & exit. And here it is.
01:22It looks very much like our front page, doesn't it?
01:24We can go back and edit it by going over to this contextual widget up here,
01:29click it and Edit view.
01:31That takes us straight to the Views settings pages.
01:34We will be spending a lot of time here throughout the rest of the course.
01:38The first thing that I am going to do is instead of showing the content;
01:41I am going to show individual fields.
01:43So I click Content and then change it to Fields and Apply it to all displays.
01:48I will accept the defaults and scroll down to see what that looks like.
01:52Now we are just showing the titles.
01:54You might remember that we had the employee IDs in the title field.
01:59If we scroll up to this Fields area we see that's all that we are showing.
02:03It just gives us that one field to get us started.
02:06But I want to put some useful information there.
02:08So I am going to add the First name, Last name, photo, and Department.
02:14Go over to add and search for a First name, add it.
02:19I will simply accept all of the defaults so that we can go through this quickly. Add the Last name.
02:28Remember, we changed that to Family name. Add it.
02:34We want the photos, so we click add again, search for a photo, add that, and
02:42finally one more, the Department, and add that.
02:47
02:50There, now when we scroll down we can see what we have.
02:54The first few records didn't have photos, but then remember, this is the
02:58original size of the photo.
02:59We can go back and change that by editing that photo and changing it, so that
03:04it's only a thumbnail, and apply, scroll to the bottom and see what that looks like.
03:10Much better!
03:11I will just make a few other changes.
03:13The first one is I don't like the way that the shows all these labels and it's
03:16all just sort of one thing after another.
03:18There is a very easy way to change that.
03:20I am going to change it from an unformatted list to a table.
03:24Apply and Apply to all displays.
03:26I am just going to accept the defaults. Go down.
03:30Already, it looks much better, doesn't it?
03:32But let's say that I want to be able to filter this depending on what
03:35department somebody is in.
03:36We can do that with exposed filters.
03:38I will add a filter, select Department, and then expose it, and make the label
03:46simply Department, Apply.
03:49Now as we scroll down you see that people can actually select this to see only
03:53those people who are working in the field, very handy.
03:57The last thing that I'm going to do is to go back up to my Table settings and
04:01make all of the fields Sortable.
04:03Now not all of them will be Sortable;, for example, the photo really doesn't
04:07have any sort of sorting order, but all of the other ones will be.
04:12As we go down we see, yup, we can sort by the Family name and so forth.
04:16The last thing we have to do is to Save this view.
04:20There it is on our page with the photos and all of the fields we put in.
04:23Amazing, what you can do so quickly with Views, but these are the things that we
04:27are going to learn in more detail as we go through the course.
04:29So I am just going to go back up to this view and keep things clean by deleting it.
04:34I'll go to my list of Views, find my Simple list of employees, and Delete.
04:41I hope that gives you an idea of the amazing power of Views to change how data
04:45appears on your site, and we've only just barely scratched the surface.
04:50Most of the rest of this course in fact, is all about making Views do
04:53exactly what you want.
04:54We will start off easy, but by the end of this course, you'll see how you can do
04:59some amazing things with it.
Collapse this transcript
Learning from built-in views
00:00I have to warn you ahead of time, Views is very, very complicated.
00:05Fortunately, its creators have done a lot over the years to make it easier to use.
00:09One thing they have done is to include several sample views with the module.
00:13You just enable them, play around, and can then return them to their
00:16original state if you want.
00:17This is a terrific way to learn how Views works in a danger-free way and this
00:22video shows you how.
00:23To get there, we go to Structure and Views.
00:27Before we go on, I just want to point out this warning about the advanced help module.
00:31It'll stay there until we fix it which we will do in the video changing views
00:35administrative options.
00:37But anyway, let's get back to our Views.
00:38I am going to Ctrl+Click on this homepage button here, so that we can see what
00:43the front page looks like.
00:44If you're on a Mac, you can open a new tab by Command+Clicking.
00:48We're going to emulate this page and then make some changes.
00:51We go back for our Views, and as we scroll down, we see that there's an option
00:55already for front page.
00:57This is one of the built-in views and we enable it very simply by clicking Enable.
01:02There are some other options here and these options actually change as you go
01:06along as you'll see, but right now it's easy enough; we will enable it.
01:10We can then edit it like any other view by clicking on the Edit.
01:13There is something strange about this page however.
01:17We don't see any kind of Save button up here, until we've made changes, and in
01:22fact, if we were to go to view that page right now, I'll do that in a new tab,
01:27it says that it's not found.
01:29This page doesn't actually become real until you've made some changes.
01:33So I am going to change the Title here to Employee list and Apply it. Now I can save.
01:42Once I have saved I can view the page by clicking here. There it is!
01:47If we switch between that and the original front page, you see that they look
01:51almost exactly the same, except of course for that title that I put here.
01:55One difference between them is as little contextual widget which you can click
01:59to go back to edit the view.
02:01If we look at our regular front page, we don't have that.
02:04We only have the widget that lets us edit or delete individual nodes.
02:08But let's go back for a View.
02:11Let's scroll down and see exactly what this page is showing us.
02:14It's showing all content that's published and that's promoted to the front page.
02:19That's very much the same as what's on our default front page, but since I've
02:23decided I want this to be an Employee list let's add another filter criterion.
02:27The filter that we will add will make our view only show nodes if they're of the
02:31Employee Content type.
02:33Now you could find that by scrolling through this whole group here, and as you
02:37can see there are a lot of options.
02:39Another way that you can see the different controls is by filtering them by Type.
02:43I happen to know, for example, that the selector is in the Content group.
02:47The easiest way to do it is to simply type in the search box.
02:51We are looking for the Content Type Employee.
02:54So we'll do a search for Content Type or just the Type, yup, the Content Type.
03:01Select that and add the filter.
03:03We want to show only Employees and then click Apply.
03:08Now as we scroll down to our preview, we see that it's doing exactly what we wanted.
03:13Go back up and Save.
03:15If we had a Location Content Type or a Basic Page or Article or anything like that;
03:20that had also been promoted to the front page, this would exclude them.
03:24But we can do a lot more.
03:25Let's go back up for Employee list and reload the page.
03:29Now what we did didn't change anything, but let's say that instead of having it
03:33sort so that the most recently added is at the top, the lowest number is at the
03:37top or even better, how about in alphabetical order by last name?
03:42To do that we go back to our front page, go down to Sort Criteria, and add one.
03:50You might remember that's Last or Family name, and there it is.
03:54Check it, add it, and yes, that's what we want.
03:57We want it to be ascending by last name. So we Apply it.
04:01Now you'll notice that these are in whatever order you created them, since we
04:05created the Family name sort last, it shows up at the bottom.
04:08You can rearrange it by going up here to this little widget, clicking rearrange
04:13them, and drag it up to the top if you like, and Apply.
04:17Once again we Save.
04:19As always we edit first, then Save, and then if we go back for Employee list and
04:23reload the page, we see that indeed it's Bueti, followed by Hussein, followed by
04:28Jones, all alphabetical.
04:30The thing with built-in views is you can always go back to the way it was by default.
04:35Let's go back to our view here.
04:37We are all saved, that's good, and then go back to our list of Views.
04:41Since we enabled this and it's a built-in view, we have an option here to
04:46disable it and also simply to Revert it.
04:48I am going to just Revert it.
04:50It asks to make sure that I want to do that, and it's back to the way it was.
04:54Finally, I'll simply disable it again. Don't worry;
04:57we'll be coming back to the front page later in the course.
05:00Obviously, we didn't do very much here.
05:02The point is just to show how you can play around safely using built-in Views.
05:07One thing I didn't show you is that you can in fact clone a built-in View.
05:11So if you find something that you think looks good;
05:13you can create a copy and then start working with that copy.
05:16We will dive more into this interface in the video:
05:19Diving into the Views' interface.
05:21But seriously, there's no better way to learn your way around than to just edit
05:25these built-in Views.
05:27I do have two recommendations before you get started though.
05:30First, don't do it on a site that's already in use, because it could start
05:35looking weird to visitors.
05:37Second, clean up after yourself.
05:39It can get really confusing if you end up with dozens of cloned views and you
05:43don't know which one is which.
05:45But if you follow those two rules, there's no reason not to take advantage of
05:48these excellent examples that come with Views.
Collapse this transcript
Creating and deleting a simple view
00:00Now that you've gotten an introduction to Views, I'd like to go back and show
00:04you exactly what I did when I first demonstrated Views in the understanding why
00:08Views is our useful video.
00:10At that time I created a table of employees.
00:13It showed more information than you now see on the front page.
00:16I will go through the same process here and then go a little further.
00:20Most importantly, you'll see how to get started creating views that will
00:23display anything you want.
00:25To get there as usual, you go up to Structure>Views and Add new view.
00:32I am going to call this View, Employee list.
00:36We can add a Description if we want.
00:37I will say, All employees in a variety of forms.
00:44Now the rest of this page is a wizard that walks you through the process.
00:48That's new and recent versions of views.
00:50If you saw my earlier course, Drupal 6:
00:53Online Presentation of Data, you will remember that you first had to create the
00:57view and then add all this stuff later.
01:00But this version takes the most common steps that people do when they create a
01:04view and puts it upfront.
01:06Don't worry, you can ignore this if you want and do things the old-fashioned way.
01:10You'll be able to change all of this later.
01:13But I'm going to get started by showing only content of the Employee content type.
01:19Going down we see that we are going to create a page with this information.
01:22Now, right now we're showing an unformatted list of teasers, that's exactly the
01:26same as what's on the front page.
01:28I'll show you that in a tab up here.
01:31See it's just an unformatted list, showing a little bit of information, the
01:34title, the first name and the last name as we defined in an earlier video.
01:40Instead, I am going to change this to a Table.
01:42There are some other options which we will get to later on in the course.
01:46In addition, I am going to create a block.
01:49A block is usually a smaller version of the same view so that, for example, you
01:53can show just the titles instead of the entire piece of information but for now
01:59I'm going to leave it in its default settings.
02:01Then I click Continue & edit.
02:03This brings us to the page where you start to make changes to the view.
02:07You can add more fields, change the sort order and so forth.
02:11I will save all of those details for the next video diving into the Views interface.
02:16But for now, I'll just show you how to Preview, Save, and look at the results of the view.
02:21Although we've created this, it hasn't become permanent yet because we
02:24haven't clicked Save.
02:25I will do that right now just to make sure that we don't lose it, and I
02:29recommend that you do that whenever you create a new view.
02:32When we scroll to the bottom, we see what this view looks like.
02:35Right now, there's not much to it.
02:37We scroll back up, we look in the Fields area it's only the title of each of
02:41these nodes of the Content Type Employee.
02:44Now let's go back to our list of views.
02:47The fastest way I found to do that is to simply click on Views in this
02:50breadcrumb, or alternately you could click on Structure and Views as we usually do.
02:55I will just use the breadcrumb here and there's our view, Employee list.
03:00We can take a look at what that page looks like by simply clicking on this path
03:04link here, I'll Ctrl+Click so it opens in a new tab, and indeed it's in a table
03:11and it looks pretty much like we saw in that preview.
03:15So that's how you create a view.
03:17Now let's see how to delete it and so forth.
03:20There it is in our list and it's called Employee list.
03:23This group of operations over here gives you the option to disable it, which
03:27simply turns it off.
03:28When I click that, I can then go back, find it in my list down here, it's in
03:32alphabetical order and re-enable it, and of course it flows back up to the top
03:38in alphabetical order up there.
03:40I can also clone it.
03:42This creates a new version of the same view.
03:45I'll do that and I will call it Clone of Employee list, that's a fine name.
03:49I will save it and then go back to our list of views.
03:52There is the Employee list and the Clone.
03:56There is one problem with creating direct clones like this.
03:59You'll notice that they both have the same path that can create a conflict.
04:03So whenever you create a clone, make sure that you rename the page path.
04:08Change it to something else.
04:09For now, I am just going to delete this clone since we don't really need it.
04:13Say delete and confirm.
04:15Another selection here is to Export.
04:17I will go down to Export here and it gives me the entire view in this long
04:22programmatic kind of way.
04:24Although it doesn't look like much you can Copy this, Save it in a text file and
04:28then re-import it into another site.
04:31The thing is, when you re-import that into a new site, it has to have exactly
04:35the same file names as the old site.
04:37If it doesn't it simply won't work.
04:40But let's get back to our views.
04:41There is one more thing I want to mention before leaving this list of views.
04:46Earlier in the course I talked about the built-in views, that is the ones that
04:50come with the views module itself.
04:52I am going to just enable this Archive once so you can see what I mean.
04:56So Archive is a built-in view, an Employee list is one that I created.
05:01These menus are slightly different.
05:03That's because this one, the one for the built-in view doesn't have a delete
05:07selection like the one that we created does.
05:10You can't delete the ones that are built into Drupal.
05:13That's okay, you usually don't want to anyway.
05:15They are really there for reference.
05:16I will just disable it and we are back to the way we were.
05:20That takes you through all you need to know about creating and deleting views.
05:25At this point, you could just go wild and experiment on views to your hearts content.
05:29But the devil is in the details and there are a lot of details when you
05:33start playing with views.
05:35The next video gives you some insight into all of those buttons and switches
05:38that you see when you start editing views.
Collapse this transcript
Diving into the Views interface
00:00In a couple of earlier videos I sort of glossed over Views interface to quickly
00:04finish tasks without much explanation.
00:07That's because Views is mind- stretchingly complex and its interface can be
00:11pretty intimidating.
00:13But now that you've seen what Views does, it's easier to explain how to manipulate it.
00:17So let's dive right in.
00:18To go there, as usual, we go up to Structure and Views.
00:22You've already visited this screen several times.
00:25In the video "Learning from built-in views" you saw how to clone views.
00:29Then in "Creating and deleting a simple view" you saw the steps that you take to
00:33go through this screen.
00:34So we are going to skip that and go straight to the view we created earlier,
00:38this Employee list here and click Edit and see all of its settings.
00:42When we scroll to the bottom, we see a preview of how that view will look when
00:46it's published. And if we go back up to the top, because this is a page, we can
00:50view the page by clicking this view page link, I am going to do that by
00:54Ctrl+Clicking on it to open a new tab.
00:56On the Mac of course that would be a Command+Click.
00:59Although there is a lot here, the page is basically broken into four areas.
01:03We already talked about this administrative area at the top a little bit,
01:07so that leaves the area in the middle.
01:09I want to point out something.
01:10If I make a change, let's just say that I change this from Employee list to List
01:15of employees and then apply it,
01:18we get a warning. Remember, we always edit and then save.
01:22It's easy to fall into a false sense of security because you see the way
01:25that things are working here in the preview, but if you don't save, it'll all disappear.
01:29I am going to go back to Employee list, there.
01:35Even though we've gone back to the way it was, View still thinks that this has been changed,
01:39so once again, you should save.
01:41In this video, I won't go into this top area where you can edit the Views name
01:44and description and do a few other things that are specific to the entire view.
01:48We will talk about that more in the video "Changing Views
01:51administrative options."
01:53I also won't talk much about this area here.
01:56So let's get down to the main part here, this whole area in the middle.
02:00This left area is where you'll find the settings that you will most often change.
02:04These are the ones that are really essential to your views.
02:06The central part changes depending on whether you're editing a page, a block, an
02:11RSS feed, or some other kind of display.
02:13I will show you that by switching to our Block. And as you see, it changed from
02:18Page Settings to Block Settings and several of the options here changed.
02:21I am just going to go back to Page.
02:24Finally, over here on the right, you have Advance settings.
02:27We will get into these much later in the course, but for now we can leave this closed.
02:31Let's get back to those basic settings.
02:34These controls work in a very similar matter, no matter what the control is.
02:38You first click here on whatever the control is and that brings up an overlay.
02:42That's where you make the actual changes.
02:44For example, I am going to change this from a Table to an Unformatted list and then Apply.
02:50You might then have additional options which will show up in that overlay.
02:53I am just going to accept the defaults although, of course, as you learn more
02:56and more about Views, you are going to want to explore all of the options. There
03:00is a lot of them and they vary from control to control.
03:02I will just say Apply and then scroll down and see what that did.
03:06It doesn't look very different, but if you look, there is a subtle change: instead
03:10of it being in a table, it's simply in an undifferentiated grouping of nodes.
03:14That is, it doesn't show the table formatting here.
03:17As we scroll back up to the top, you'll also notice that some controls appear
03:21when you change other controls.
03:23This Show section wasn't there when we were in the table format.
03:26I'll switch it back and you'll see.
03:29Accept the defaults, and there it is. The Show part has disappeared and we are
03:33back to a table down here.
03:35I find that the most important setting in this group on the left is the Field setting.
03:39This is where you get to say exactly what goes into your view.
03:44Right now, we only have the title showing; that's why it's just a very simple
03:47list of these numbers which are the employee IDs.
03:49But if we click Add, we see all of the fields that we can add.
03:54It's a huge list and can be quite overwhelming.
03:57There are two ways you can narrow it down, though.
03:59There is a filter here, so you can show only those that are relevant to, say,
04:03Users, or you could go back to the whole group and search by the name of the field.
04:08For example, I am going to add the Family name and the First name.
04:11So I will just do a search for name and see what comes up.
04:14Yup, there it is. And you could add multiple ones at one time like this.
04:19Add and configure fields, and then it will walk you through both of those at one time.
04:23So here is the Family name, I will just accept it, and the first name, and I
04:27will just accept it.
04:29As we scroll down, we see the results.
04:32That interface is very similar to the one you will see a minute for Filters and Sorting.
04:36You choose Fields from a long list and then change their settings.
04:39But for now, let's finish up with Fields.
04:42Let's say that for this view, I wanted to be First Name before Family Name.
04:45Easy enough. I go back up to Fields and then use this pop-up to say rearrange,
04:51then I drag it however I want and Apply. And there we are, and always remember
04:56every once in a while to save.
04:59The interface for changing fields is very similar to the one you'll see for
05:02Filters and Sorting.
05:04You choose criteria from a long list and then you change their settings.
05:08Let's go on to Filters.
05:09To add a filter, just like with fields, you click Add.
05:13Let's say that I want to see only those employees who have photos.
05:16I will do a search for photo. And the one that I want is fid. These others are
05:22attributes of the photo, the alt tag or the height and width and so forth.
05:26I will just select it and then click Add.
05:30What I want is to show every one where it's not empty and Apply.
05:36Even though you can't see it, these are the ones that have photos, and we could
05:39prove that actually by adding a field here, just the way that we did before,
05:43photo, add the Employee photo, and scroll down, and you see that it's showing all
05:51the ones with photos in their original format.
05:54I'm not going to keep that. I will just go in and remove that by clicking on the
05:58link and then going to Remove.
06:00The Sort criteria works very similarly.
06:02I'll show you by adding a sort criterion to sort by family name.
06:09I select it and add it, and then I apply.
06:13As we scroll down though, you will notice that it's not actually in the correct order.
06:17That's because I previously had this one which sorted by Post date, so that one
06:22is still at the top.
06:24If there are two on the same date, they will show up with the Family name in the
06:27correct order, but I have to rearrange those or get rid of that postdate.
06:31I will rearrange it and bring this up to the top.
06:34I apply. Now it sorts properly.
06:37Let's go on to that second column.
06:39As I say it's specific to whether you're looking at a page, a block, an RSS feed,
06:44or any of these other displays, which we will get to later in the course.
06:47There is one part here that I do want to show you, which is this Pager.
06:52You might have a lot of nodes in your View and wonder why I am not seeing them all?
06:55Well that's this Pager area, which shows up both in the Page and the Block.
07:00You see it there in the Block.
07:01I'll switch back to the Page, and I will show you the difference by changing it
07:05to show only, say, two items at a time and Apply.
07:10Now when we scroll down to our View here, we have this thing at the bottom that
07:14lets us go from page to page.
07:16This is what the pager is, and you can change the way that this pager looks by
07:20clicking and saying, do I want it full, or do I just want it a small one, do I
07:24want to show all items, and so forth.
07:28But for me, I am going to change it back to 10 and apply.
07:34So that's how you get around this whole area in the middle.
07:37I want to show you a neat little shortcut down here in the Preview area though.
07:41You might notice that there are these little contextual widgets.
07:44So if you want to change the title and you're not sure quite where it is up
07:47here, you can just click on this and it goes directly to that control.
07:52Similarly, if you click on the widget next to Content, you have a lot of options
07:56for changing right there next to the Preview area.
07:59You can choose whichever way to work that you think works best for you.
08:02I generally tend to do things up here because I'm used to it, but this is a
08:05really nice addition that they put into a recent version of Views.
08:09Finally, I will save this view and go to my front page again.
08:14I know that was a whirlwind of activity and I didn't really go deeply into any part of it.
08:20My point wasn't to teach you everything about Views in one lesson; that's simply impossible.
08:24It was instead to live out a quote attributed to Albert Einstein: "I don't
08:29have to know everything;
08:30I just have to know where to find it when I need it."
08:33I recommend you take some time now to go back and play around a bit.
08:37The information you have seen here, coupled with ecstatic curiosity, will
08:41teach you a lot.
Collapse this transcript
Surveying field types
00:00Now that we started poking around the Views interface a little bit you've
00:03probably noticed the overwhelming amount of fields available for display,
00:07sorting and filtering.
00:09I'd like to take a few minutes to look through them so you can get a sense of
00:12the patterns that tie them all together.
00:14Although there are dozens of fields with lots of different settings you'll find
00:18that there are some similarities that make them easier to understand.
00:22To start as usual we go up to Structure and Views.
00:25I'm going to open up the Employee list page in an extra tab here so we can
00:31switch back and forth if we like.
00:32This is the way that I generally like to work.
00:34Then I'm going to go down and edit that View.
00:37As we scroll down to the Preview area we get a sense of what it's going to look like.
00:41Notice however that the appearance actually changes when you go back to that
00:45front page, that has to do with the theme although the basic information is the same.
00:50We'll go back to our View.
00:52We now have three fields in our View;
00:54we added them in the video diving into the Views interface.
00:57We can edit any of them by going up to this Fields area here and clicking them.
01:03In general, when you edit a field the settings are in five groupings.
01:06The one up here at the top is the most general grouping.
01:10Create a label and Exclude from display tends to be the same pretty much no
01:14matter what fields you add, Link to the original piece of content is more or
01:18less special to the title part although you will see it in some other fields.
01:22These other ones Style Settings, No Results, Rewrite, and More you can open by
01:27clicking on their links and see all of the different things in there.
01:31Some of them expand when you check their checkboxes, like so.
01:34We'll go into all of these in a little bit more detail in the video Adjusting
01:38the Settings of Individual Fields in a View.
01:41But for now I'm just going to cancel out.
01:44Now let's go back and add a field.
01:47Here we see that huge list of all of the field types that you can add and as
01:51I've mentioned before there's the Filter here and you can Search for the
01:55individual field type here.
01:56I want to talk a little bit more about this Filter.
01:59Most of the criteria that are relevant to specific fields are in the
02:03Content group here.
02:04When I select it you see that it includes such things as the Family name, the
02:08First name, Employee photo.
02:10These are fields that we added earlier on in the course.
02:13In general they fall into five groups.
02:17The first criterion is actual fields.
02:20This is what I just showed you, the photo, the family name, the first name and
02:23so forth, and if we look at our list back here we see that it has Appears in:
02:28that means it's an actual field, whereas this Edit link does not actually appear
02:32in anything, it's what's called metadata that's attached to the field.
02:36The second kind is Static metadata.
02:39These are the things that don't change and it's easier to understand what that
02:42is if we look at the Dynamic metadata.
02:45For example, when something was last updated if there are any new comments and so forth.
02:50If we go back to our list you can see what we're talking about.
02:53For example, Last comment author and Last comment time are examples of dynamic
02:58metadata, whereas Link is an example of something that's static.
03:02It's specific to that field but it doesn't change over time.
03:06The fourth kind is Control links.
03:09You might've noticed that there are some things here that lets you edit the content.
03:13So you can actually create a view for administrator's that lets them quickly
03:17click on an Edit link and go back and change the content itself.
03:20There is also a Delete link and a few other things like that available.
03:25Finally, we may have some other kinds of links that are defined by modules.
03:28If we go back to our list here and go back up to the top and change this Filter
03:33to Feeds item you'll see some of the criteria that appeared only because we
03:36installed the Feeds module earlier on in the course.
03:39Now the Field settings that you see depend very much on the fields that you add.
03:44To demonstrate I'm going to add an employee photo to this View as I've done a
03:47few times in this course already.
03:49I'll go to Content then I'll search for photo, and there it is, we add it and
03:55Add in configure fields.
03:57You might remember before we only had three options up here.
04:01It was Exclude from display, Link to node and Create label, but here since it's
04:06an image we can also change the way that it's formatted and the style, and in
04:10fact, I'm going to change this to a thumbnail because you might remember some of
04:13those graphics were really big, and if we leave it in original image it'll just
04:17fill the entire screen.
04:19Finally, we can decide whether we want to make that image clickable.
04:22I'll say yes and I'll link it to the file itself.
04:25I'll Apply and scroll down to our preview to see what that looks like.
04:29Yeah, I like that a lot.
04:32And you might remember, by the way, that we earlier added a filter so we're only
04:35showing those that have photos.
04:37I'm actually going to remove that now.
04:41Now we see all of the employees, including those that don't have photos.
04:45Finally, I'm going to move things around a little bit.
04:47I've never really liked that we had the ID here and that's how you get to the
04:51full information about the person.
04:53So I'm going to move the photo over to that location, remove the ID and make
04:57it so that instead of seeing the file when you click on this you see the actual record.
05:01First, I'll go up and Save and see what it looks like on our page.
05:05Yup, it looks pretty much as we expected and if you click on any of these now
05:10you just see the file itself.
05:12Let's go back and change that.
05:13Go down to Fields and rearrange.
05:18On this page you can not only move things around, you can also remove them.
05:21So I'll remove the Title, and remember, this only removes it from the View, it
05:24doesn't affect any of the underlying data.
05:28Then I'll move the photo up to the top and save it by clicking Apply.
05:32Finally, I'll change what that photo links to by clicking on photo and then
05:36saying Link image to the Content and Apply.
05:39Then to be sure we'll look at our Preview. Yup!
05:42It looks pretty good.
05:43Save it and check it out on the page itself by reloading. Yup!
05:49That's exactly what I want to happen.
05:51Once again, I recommend at this point that you take some time to explore all of
05:55those field types that look interesting to you, that's what I did when I first
05:59discovered Views and I found that learning the quirks among them gave me a sense
06:03of what could be displayed and the limits of what I'd have to work with.
06:07It was like adding colors to my palette and from time-to-time I still go back
06:11and re-explore all of the colors that are available to me in Views.
Collapse this transcript
Adjusting the settings of individual fields
00:00Now that you know the kinds of fields that are available to put in a View
00:03let's take a closer look at the controls you have over the display and
00:06behavior of those fields.
00:08We're starting out by looking at our View on our site, which you might remember
00:11is that employee-list.
00:14To change it we could go up to Structure and Views or simply click on
00:17the contextual menu.
00:19Go down to Edit View and there we are.
00:21To show the settings in Views I'm going to go down to my Fields here and
00:25change this First name.
00:28I'm going to go through all of the settings in here but of course I can't go
00:31into every variation because as I say on the different kinds of fields there
00:35are different kinds of settings, but I'll cover the ones that are common to
00:38most of the fields.
00:40The first part is this bit about for all displays or whether it's only for this
00:44page that is if it's overridden so chose up only on the page.
00:48I'll explain this quite a bit more in the video varying how a View appears in
00:51different displays, but to show you just very briefly it relates to whether or
00:55not the changes you make now are to just this page or if they also affect blocks
01:00or RSS feeds or any of the other kinds of displays that you add.
01:03Again, we'll go into much more detail later on in the course.
01:06For now let's just go back to our First name field by clicking it.
01:10The next setting here is whether it should create a label?
01:12I'll close out here and show you what that means.
01:15Right now, we're showing our view as a table and you see that with this
01:18alternating band of color here from white to gray and white again, and here's
01:23our label right here.
01:24If we were to turn it off it would simply disappear from the header but that
01:28label changes in how it appears from one kind of formatter to another.
01:32And to demonstrate that I'll go up to the formatter here and change it from
01:35Table to Unformatted list.
01:38I Apply and then scroll down again.
01:41Now we have it as an unformatted list and you see that the label is just before
01:45or whatever the thing it is that describes, First name: Eli, Family name:
01:49Hussein.
01:49I'm going to go back to the Table which is the way that I wanted but you can see
01:53that sometimes you will want to label because it shows up well in tables, for
01:56example, but perhaps it doesn't look so good in other kinds of formats.
02:00So I'll just switch back to Table, and I'll Apply just to get out of all of
02:04these options and we're back the way we were.
02:07We'll talk more about display formats in the video improving view appearance
02:11with grid, list and table formatting, but let's get back to our First name field
02:15by going back up and clicking on it.
02:18The next setting is this Exclude from display.
02:21This setting will make a lot more sense when you see the video rewriting field
02:24output for interesting results.
02:27Because once you start doing that you find it necessary to hide some fields
02:30otherwise they appear twice in your display.
02:33Again, we won't go into it now but we'll talk about it in that video.
02:36Going down a little further we have this Formatter pop up.
02:40If there is any styled text in your field you can choose to have it either show
02:44by showing it as the Default or just have it as Plain text which will strip out
02:48all of that formatting.
02:49Finally, you could have it as Trimmed, which comes into play when you have a
02:52very long string of text.
02:54Drupal will automatically cut it down to just show a summary, typically the
02:58first paragraph or so but we'll leave it as Default.
03:01Now we come to the other four groups of settings.
03:04In the Style Settings you can change the way that these fields appear.
03:08As you check these boxes a new group of options appears.
03:11This one, for example, lets you change the HTML element and this one lets you
03:16change the CSS class.
03:18Explaining how to use these settings is well beyond the scope of this course
03:22because it would mean teaching the whole world of CSS and HTML;
03:26instead refer to those courses on lynda.com if you're curious.
03:30The last checkbox here is Use field template.
03:33This is quite advanced and requires an understanding of Drupal theming.
03:37Again, watch the lynda.com videos about that subject to understand when this
03:41setting would come into play, otherwise just leave it unchecked.
03:44Continuing further, we have the No Results Behavior group.
03:48This lets you hide the field formatting if there's no information in the field.
03:52Here is an example.
03:54Let's say that you're listing sales results for a group of salespeople.
03:57What if some of them don't sell anything because they were on vacation?
04:00This setting lets you leave their names off of the list instead of embarrassing
04:04them with a big fat 0.
04:05Scrolling down further we have the Rewrite Results group.
04:09You can change the way the fields are output in quite a lot of ways, including
04:13combining them together.
04:14So, for example, right now we have First name and Family name showing up in
04:18different columns in our table.
04:20You could smoosh those together by rewriting the output and then hiding the
04:23one that comes first.
04:25It gets quite complex but I'll explain it a lot more in the video Rewriting
04:29Field Outputs for Interesting Results.
04:31Finally, we come to the More group at the bottom.
04:34This covers anything that's left over.
04:36One thing that's always here is this Administrative title.
04:39For example, we're looking at First name here but let's say that I wanted the
04:42Administrative title to be personal name, I'll change that and Apply.
04:47Now when I look up here in the Fields list we see that Personal name, but if we
04:51go down to the view itself it doesn't change anything in the view.
04:54This is strictly for administrative reasons.
04:56I'm going to go back up and change it back.
04:59Once again, I click on the field, go down to More and remove that setting.
05:05I'll accept that and Apply.
05:07As you can see Fields settings comprise an extremely rich area for
05:11modifying your view.
05:12In fact, when I make a view this is where I find myself investing most of my time.
05:17Again, you'll find some settings we just didn't have time to go over here.
05:20On graphic's fields, for example, you'll be asked what size the graphic should
05:24be but the skills I showed you here should be able to help you figure out those
05:28variations without much trouble.
Collapse this transcript
Sorting and filtering data
00:00What good is a collection of data if you can't find what you want or if it's in a random order?
00:05This video shows you how to solve both problems through sorting and filtering.
00:09There are essentially two approaches for sorting and filtering and you'll
00:12usually find that you use both when you're building a data-driven site.
00:16The first approach is to pre-sort and filter the data so it appears a
00:20certain way by default.
00:22The second is to give site visitors the tools to sort and filter it themselves.
00:26We'll cover both methods.
00:28We're looking at the view right now and we can edit it by simply going up to the
00:31contextual menu and clicking Edit view that takes us back to our controls.
00:36The filtering and sorting criteria are down here in the first column toward the bottom.
00:40We'll start with this Sort.
00:42You can add Sort Criteria very much like you added Fields earlier in the course.
00:46Simply click Add, and I'm going to sort also by First name.
00:50So I type name and there it is, First name, check it and Add.
00:56When we go to the Settings screen you'll see that you have far fewer options
01:00than you did when you added a field.
01:01There's sorting ascending and descending, that's pretty obvious.
01:05There's a More link which is pretty much like what you saw on Fields, you
01:07can edit Administrative title and then there is this box here Expose this sort to visitors.
01:13This is where the magic happens, and in fact I'm going to do that.
01:16And then I'll just accept the default settings and scroll down and see what that did.
01:22It didn't actually change our sorting at all.
01:24That's because it shows up last in this group of sorting criteria, but what it
01:28did do is it added this pop-up here so that we as the users can choose to sort
01:33it in ascending or descending order by first name, and there we go, we sorted it
01:38descending and now Tom starts before Sylvia.
01:41There is one strange thing, which is this pop -up menu doesn't look quite the way I want;
01:45I don't think it really needs that parenthetical phrase.
01:48So I'll go back up, click our First name and you'll notice it shows this Exposed
01:52here and simply remove that from the label.
01:58Another interesting thing is no matter where it is in this list here, when you
02:02expose a filter it takes precedence over the others as you just saw.
02:05I'm also going to make the Family name sortable. Why not?
02:09It's easy enough to do.
02:10Simply Expose, remove the part of the label I don't want and Apply.
02:15Now we have a choice about whether to sort by Family name or First name, and as
02:20you might guess it works exactly as you expect.
02:22Now we're sorted by Family name Ascending and Descending. So that's sorting.
02:29Before, we go onto filtering, as usual, I'll go up and Save, then I'll go back to my view.
02:36Filtering works very much in the same way.
02:38To demonstrate this better I'm going to quickly add a few fields.
02:44I'm going to add the Department, Job, and Location fields to our table.
02:48I'll filter by Content.
02:50There is Department, there is Job and there is Location, Add and configure fields.
03:01I'll simply click through to accept these defaults.
03:03Of course I can change them later if I really want to.
03:06Now let's go down and see how that looks in our preview.
03:12As you can see we're getting a much more complex table here, very good.
03:16Before going on once more I'll Save, and then go back and edit my view.
03:23Now, let's start filtering.
03:24I'll go down to Filter Criteria and click Add.
03:28As with Sorting you can expose a filter and that's actually what I'm going to do.
03:33I'm going to add a Department filter by checking the box Add and configure
03:36criteria and Expose it.
03:38Before I expose it you'll notice that you can choose which options here so that
03:42you could, for example, filter to show only those people who work in the field,
03:45and if you don't expose this filter that's all you'll see on the view.
03:49This is how you can set up views that show very specific information from groups of nodes.
03:54You can also change the Operator to say it is this thing, or it's not this thing.
03:59So, for example, you could show everybody except those people who work in hospitality.
04:03But let's just expose this.
04:05Remove our label parts that we don't want and Apply.
04:11Now as we go down we can not only sort but we can also show only those people
04:16who work in a specific department and there we are.
04:21Those are just the fieldworkers.
04:22Once again, I'll go up and Save and then go back and edit my view.
04:29Now there are a few quirks about filters I want to show you.
04:32They'll become evident when I let visitors filter by job and location.
04:36To do that I go down to Filter and as usual I Add.
04:40I'll select only those Content ones to make it easier to find and then there is job.
04:45I'll Add it, Expose it, fix the label a little bit and Apply it.
04:53Then I do the same for location.
04:57Add it, Expose it, and Apply.
05:02We scroll down to the Preview area and you see the things that we can filter on,
05:06Department, Job, and Location.
05:09Department and Location have pop-up menus whereas Job is a free-formed field,
05:14so we'd actually have to type-in the job that we want to search for, we'd have
05:17to know what it is.
05:18You might remember earlier in the course we actually set up these three fields
05:21in three different ways.
05:23One was a taxonomy, one was by reference and one was a field list.
05:28The way that you set up the field affects the way that filters will show up ultimately.
05:32The Location field was set up as a reference and the Department field was set up
05:36as a list within the field whereas Job is part of a taxonomy.
05:40You'll have to play around with these to figure out which one will give you the
05:43filters that you want.
05:44I would recommend once again that before importing a whole lot of data from
05:48somewhere you do this with a small subset of your data so that you can figure
05:52out all of these little quirks before you commit that to the site.
05:56There's one last thing I'm going to do is just change this label, which I forgot
05:59to do earlier, easy enough to do.
06:02Go up to Content Location in my Filter and fix the label.
06:05You'll find yourself doing this sort of thing all the time as you're building
06:08your site because there are so many things to change.
06:11Go down, looks good.
06:13So I'll go up and save it.
06:15Finally, I want to show you a neat set of controls that's only available when
06:19you're using the table view as we are down here.
06:22I'll go up and I'll Edit, and then I'll go over here to Settings next to Table.
06:28You can actually affect the sort in tables by using this Default Sort column and
06:33also this Sortable set of checkboxes.
06:35I'm going to make the Family name the Default Sort and make all of the
06:39other columns sortable.
06:41Some of them in fact won't be sortable even though we say that they are.
06:44For example, photo doesn't have a sort order but we'll say Apply and see
06:48what that looks like.
06:51As we scroll down now our headers are clickable whereas they weren't before.
06:55We can simply sort by clicking First name and then if we click it again it sorts
06:59in the other direction as you can see from this arrow.
07:02Very handy but it only works with the table format.
07:05If we sort by Employee photo it actually sorts by the file name, which
07:08isn't really that useful.
07:10So I'll go back to my Field settings and uncheck that Employee photo Sort.
07:15I'm also going to remove the Default Sort from the table setting since that may
07:18confuse Drupal compared to the other sorting criteria we gave.
07:22I'll simply change it to None and Apply.
07:26Then as usual I Save, and there we are, we have all of our sorting and filtering
07:31criteria available to us.
07:33We'll talk about the other settings in that table screen in the video Improving
07:37View Appearance with Grid, List, and Table Formatting.
07:41Sorting and filtering add enormous power to your web site, and in essence it
07:45turns it into a kind of controlled search engine.
07:47I follow discussions among Drupal administrators who are running real estate
07:51sites, and one of the most common questions is, how can I let visitors search
07:55property listings by price and features and so forth.
07:59The answer is exposed filters, and if you look at most real estate listing sites
08:04you'll will notice that their search and sorting functions are a bunch of fields
08:07that look a lot like what we've started creating here.
Collapse this transcript
Changing Views' administrative options
00:00Most of what we've gone over has affected the way your data appear to visitors.
00:04But now we are going to talk about some settings that affect the way that you as
00:08the administrator interact with views.
00:10There are a lot of settings but I found that I generally only use a few of them.
00:15So those are the ones that I will give time to.
00:17We will be looking at two areas of settings;
00:20one affects all views, the second affects individual views.
00:24First, let's look at those things that affect all views;
00:27to get there, click Structure, and Views.
00:30I have mentioned this warning before in the course and later on we are going to hide it.
00:36But for now, just click Settings.
00:38This Settings page is essentially broken into two areas;
00:42the top area here is General settings and the bottom is specifically about how Previews work.
00:47In that top group, the first ones change what you see on the list of views,
00:51while the next ones change the page where you edit views.
00:55So that I can demonstrate this better, I am going to open up the list of
00:58views in a separate tab.
01:00We can see it right there.
01:01Let's go back to the Settings.
01:04First thing I'm going to do is to Show the filters on the list of views.
01:07I check that box, then go down, and Save.
01:11Now, if I go back to my List of views, and I reload, watch the top of this page.
01:17We can now filter our views very much like we filter in order to find fields or
01:21filters, or sorts when we edit a view.
01:24Let's go back to our Settings.
01:26The next thing I am going to do is turn off that advanced help warning.
01:30That's the one I just showed you.
01:31Check the box, scroll to the bottom and save, then go back and reload the page,
01:36and you'll see this green area disappear.
01:39The other way we could get rid of it of course is to add the module that they
01:42referred to which is called Advanced Help.
01:45That module is at drupal. org/project/advanced_help.
01:51But we're going to leave it off.
01:52Now, I would like to show you some of the changes that happen inside
01:56an individual view.
01:57To show that, I'm going to open up our Employee list view in a separate tab. And there it is!
02:03Now we go back to our Settings.
02:06The master display checkbox is a little complicated to explain.
02:10But if we go back to our view here, it'll become more apparent.
02:14Up here, we have our Displays;
02:15Page, Block, and then we can add additional displays if we like.
02:20You might remember that when we added a field or when we edited an existing one,
02:24we had this option to override or to change all displays.
02:28And if we make a change here, it will actually show up both on the block and
02:31also on any other displays we have set up.
02:34That's because all of these are referring to a hidden master display, what used
02:39to be called default in previous versions of views.
02:41If we go back to our Options, and we say Show the master display and Save, then
02:48let's go back to our Employee list view here, we will save it and that will
02:53reload the page, and now you see that Master display.
02:57It's just a little different way of working and you may decide that you like it
03:00one way or the other, but anyway that's where you can control it.
03:03The next setting is Always show advanced display settings.
03:06That affects when we edit any particular view.
03:08I will go back in and take a look at our Employee list again.
03:11That changes whether or not you see all of these options when you go in to edit a view.
03:16This one is a little bit unusual because at the moment, it appears not to work.
03:20But ostensibly, if you check that and go down to Save configuration, whenever
03:25you open this Edit view page, this will already be open, so you will be able to
03:29expose all of those things and have access to the Advanced settings.
03:33I expect that by the time you see this video, it will work as expected.
03:37The last part of the settings that affects all views is what exactly the Label
03:41should be when there is an Any choice.
03:44You will notice that if we go back to our Employee list here, it's what we see
03:47here, should it show up with those dashes or the little greater than, less than signs.
03:52It's a little thing but you can change it here.
03:54I am going to leave it as it is.
03:56Finally, we get down to the Live Preview Settings.
03:59To understand this, I will go back to our Edit view.
04:02It affects the part down here, the preview that you see as you change your view
04:06when you're editing it.
04:08You can have it automatically update preview when you make changes, that's
04:11what we have right now.
04:13You can also have it show certain information and statistics, and right now we
04:16are not showing very much of that.
04:18But let's go back and turn on all of those things, and then reload that page;
04:24Save configuration, and then go back to Edit our view.
04:27I will actually go up, go back to my Views, and then back in to edit.
04:34That will reload the preview.
04:36As we scroll down, we now see all of these statistics.
04:39They might not be useful to you now, but as you become more and more familiar
04:43not only with Views but also with Drupal and with theming, you might find these
04:47more and more useful.
04:48For us though, I am going to go back and turn all of those off again. Finally, I save.
04:55Throughout this, you might have noticed that we've only been working on the
04:58Basic button here on the View Settings screen.
05:01There are few things on the Advanced screen but to tell you the truth, most of
05:05them are way beyond what you're going to be dealing with here.
05:07They have to do with system administration and programming.
05:11So we won't get into those.
05:12But there is one that I want to mention, Clear Views' cache.
05:16If you have problems making your view work, that is if you make a change and it
05:20doesn't seem to show up, click this button.
05:22It will empty out all of the things that Views is remembering in order to
05:25improve its performance, and start again from scratch.
05:28It might slow down Views for a little while, but it will make sure that all of
05:32the changes that you created will actually take place.
05:36The next thing that I want to show you is the administrative settings that
05:38affect individual views.
05:40If we go back to our View here, scroll to the top, we see edit view and
05:45name/description, and that does exactly what would you expect it to do.
05:48If I click it, we can change what the View is actually called, and how it
05:52appears in that list of views.
05:55There are some other options here as well.
05:57Analyze view which will tell you if it sees any errors that might cause a
06:00problem, Clone view which makes an exact copy, and as I mentioned earlier in
06:05the course, be careful when you clone a view, because if you have a page on
06:09that view and you usually will, it will have the same path as the one you just cloned.
06:13So you'll have to change one or the other, or you will have two views competing
06:17to have the same path.
06:19You can also export the view, reorder how it shows, so that the page can be
06:23after the block, for example, and finally of course, you can delete the view.
06:27I will talk more about the Export View option in the video importing,
06:31exporting and cloning views.
06:33The last thing I want to mention is that some controls that you think would be
06:37in the Views interface are actually found elsewhere in Drupal.
06:40For example, let's say that I want to make this Employee list view, the one that
06:44actually shows up on my site's front page.
06:46First thing I'm going to do is I am going to look and see what exactly the URL is.
06:50I click on Page, okay, it's /employee-list.
06:52Now, I will just close out this view, go back to my front page.
06:58This is where we actually want that view to show up.
07:00We can change that by going up to Configuration and Site information.
07:04Scroll down, and there we have the Default front page.
07:08I am going to change it to our employee-list and save.
07:12Now, whenever we go home, that's what we see.
07:15You can learn more about such general site controls in the Drupal 7
07:19Essential Training course.
07:20Once again, none of the settings that you saw in this video except for that last
07:24one affects the information as it appears to visitors.
07:27They're really just for your own convenience as the administrator.
07:30I have to say the administrative interface reviews has really come a long way
07:34since its first version.
07:36This is essentially the third version.
07:38My course Drupal 6 Online Presentation of Data was all about the second version.
07:43I have to say it just keeps getting better and better.
07:46Views does so much that it's hard for its developers to make its options easy to access.
07:51But I think that with this version, they have done a really good job.
Collapse this transcript
5. Changing the Appearance of Views
Varying how a view appears in different displays
00:00When we looked at some data-driven sites at the beginning of this course,
00:04you've probably noticed that the data weren't always contained in the center of
00:07the page, sometimes they showed up in the sidebar and other times in maps or other formats.
00:12In Drupal, all presentation of data collections are backed by views, but the
00:17different ways of showing them are called displays within a given view.
00:21So far we've only looked at the page display, now we'll add something called a Block display.
00:26There are other kinds available as you'll see, but the procedures to add them
00:30work pretty much the same as with a block.
00:33First, I want to revisit what a block is in Drupal so you'll know where we're going.
00:38We see an example of a block over here in this Navigation block.
00:42We can see all of the blocks that are available to us by clicking Structure and then Blocks.
00:47This is a list of blocks and it shows where they are in the different regions on the page.
00:51For visual representation of where they are, click this Demonstrate block
00:55regions link, and as you see, there's a Sidebar first, a Sidebar second, things
01:00at the top, things at the bottom, and so forth.
01:03To exit that, click this link here.
01:07Now let's go back to our view.
01:08We're going to use our list of employees, but we're going to do a compact block
01:12form intended to just show the employees' names and pictures and we'll put that
01:16in the left column of our page.
01:18To do that, we go up to Structure and Views as usual, and we edit our Employee list.
01:25You might remember that we made this Master display visible in the last video,
01:29Changing Views Administrative Options.
01:31When I have that display selected, if I click on a field, I can edit it as usual
01:36and it affects all of the displays, the page, the block and so forth.
01:40If I go and edit the Page display, and then I click on any of the fields, you
01:45see I have an option that wasn't available when I edited the Master display,
01:49whether I wanted to affect All displays or just this one.
01:54That's an important thing to watch out for because you might start editing
01:57your block and accidentally change all of the things on your page, in your RSS
02:01feed, and so forth.
02:02So be careful when you start working in multiple displays to always override
02:06those things that you want to be different between the page and the block.
02:09But for now, I'll just cancel.
02:11You can add a Block display to any view that already exists, and in fact, I did
02:16that earlier on in the course.
02:17We do that in this view edit page.
02:20However, you can also do it when you first create a view.
02:23I'll show you that by going back to my Views page.
02:26I don't have to save this since I didn't actually make any changes.
02:29I click Views and then Add new view.
02:32This page that shows up when you first create a view has this Create a page
02:36checkbox and also a Create a block checkbox.
02:40When you check these and you change the criteria here, it actually creates a
02:44display within the view that you're creating.
02:47Anyway, let's go back to our Employee list, that's the one we'll actually be affecting.
02:51I go to my list and click Edit.
02:54We've worked a lot with the page, now it's go on to the block.
02:58The first thing that I want to change is the Block name.
03:01This shows up in that list of blocks that you saw just a minute ago when you
03:05move them around from one region to another.
03:07I click that None link and I'll change it to Employee list and Apply.
03:13When we scroll down to the preview, we don't actually see anything.
03:17Don't worry about it, I'll explain how this works in just a minute.
03:20Now we're going to change the block so it's different from what the page is.
03:24First thing I'm going to do is remove some of these filters, I want to simply
03:27show all published employees.
03:29I don't care what department, job, or location they're in.
03:32So I'll click Department and here's the important part, I have to change from
03:37All displays to This block.
03:39If I don't do that, I'll ruin the page.
03:41So I do that and then Apply.
03:45Then once again, I'm going to go up Department and Remove.
03:48I just did that to be sure that it was sticking with the override.
03:51I could've gone straight to Remove, but when I do this the first time, I always
03:55want to be extra-sure that I'm not going to ruin my page. So I click Remove.
04:00Then I'll do the same with Job and Location.
04:02Click Job, only This block, Remove, and Location, only This block.
04:08Now you'll notice, when I first did that override, it changed this Filter
04:12Criteria to italics.
04:15That tells me that this is different from what the Master is.
04:18The Master is being reflected in the page, but now we've done one override in
04:22the filters, that means all of the filters are overridden.
04:25The same is true for Fields and Sort, when you override one, you override them all.
04:30Anyway, let's remove the Location, it's on the Override, and Remove.
04:35We can prove that the page is still okay by clicking the Page display, scrolling
04:40down, yep, those filters are still there, and there's no italics here, so we
04:44know that it's the same as the Master.
04:46I'm going to further simplify this by showing only the employees' first name and
04:51picture, so I don't need all of these fields.
04:53I'll get rid of the Family name, Department, and all the rest of the stuff.
04:56Once again, I do exactly the same thing.
04:58First I go up, make sure that my Block is selected remember, then click
05:02Family name, and override.
05:05Once again, I Apply it before I Remove.
05:08If I just go and click Remove, I found that sometimes it will actually remove
05:12that field from all of my displays.
05:14So I first save it and do the override.
05:16Again, Family name, good, it's on override, and Remove, Department, override,
05:21Remove, and so on with Job and Location.
05:27I might have to do some additional changes after I see how that block looks, but
05:30let's leave it as it is for now.
05:32We'll go up and save and actually place that block on our page.
05:36I click Save, then go back up to Structure, and Blocks.
05:40Scroll down all the way to the bottom, that's where we have the Disabled ones,
05:44and then we see View: Employee list.
05:46That's the one we just created.
05:48You might remember that there was this left-hand sidebar called Sidebar first.
05:53I put it in there, go up to Sidebar first just to see, yep, there it is.
05:56Go down to the bottom and Save blocks.
05:59Now let's see what happens when I close the overlay, and there it is, we have
06:03the label that says it's a photo and a photo, their First name, and so on.
06:08You know what though, I don't think I need these labels here.
06:10It really doesn't make any sense.
06:12So I can go up and edit that view by going up to this Contextual menu here and I
06:16have a choice of either whether I want to change the block or the view.
06:19If, for example, I wanted to move the block to another region, I'll
06:22say Configure block.
06:23But I want to change the view, so I click there.
06:25Make sure I'm on Block, go back down and I'm just going to edit these fields.
06:30You've already seen how to do all of this.
06:33This is just applying knowledge from things that you've already seen.
06:36I'll remove the label and save.
06:39Then I'll do the same thing with the name, remove the label and save.
06:45Now let's take another look.
06:46We'll save and close the overlay.
06:48Yep, that looks a little bit better.
06:51Now the thing is Eli and LaWanda don't have pictures, so if I wanted to I could
06:55count them out and have it only show those things with pictures using techniques
06:59that you saw in the video about sorting and filtering.
07:02Now that you're starting to know views pretty well, I'm going to finish off by
07:05doing something a little fancy.
07:06I'm going to change this block so you only see the most recently added employee.
07:12So I'll go back up and edit that view.
07:15First thing that I'll do is I'll change the Sort.
07:18Right now, it's sorted by Family name, I only want it to be sorted by Post date.
07:23So I'll go in and click there, and the first thing that I do, is override and save.
07:29Now that that's overridden and we can see that because of the italics, I make
07:33sure that it's the Block display, I can go in and click rearrange and remove
07:37those other two quickly.
07:39Remove Family name and First name and then Apply.
07:43The next thing I'm going to do is make it so it only shows one, that is the most recent.
07:48Go up to the Pager and you see it's already in italics.
07:51That's because the Pager is different between the page and the block. That's by default.
07:56When you add a block, it's different from the Master.
07:59So I'll change that to show only one and Apply and I'm going to remove the Pager entirely.
08:06Actually, I'll show you what it looks like before I do that by saving and
08:10closing the overlay.
08:11Now we only see the most recent one, but then we have this strange looking thing
08:16down here where it shows all of the other ones as links here.
08:20I don't really want that, so I'll remove the Pager.
08:22And while I'm at it, I'm also going to change this block so we only see those
08:26employees who have photos.
08:27So we'll remove the Pager, make sure we're on our Block of course.
08:32So we have displaying a specified number of items, no Pager, and Apply.
08:37Only one, that's what we said before, that's fine.
08:39And then I'm going to add a Filter Criterion once again, so only those that have photos.
08:45Do a search for photo, photo id, and it has to be only those that are not empty.
08:53We go up and save and we're back.
08:57And there it is, there's our most recent employee who has a photo.
09:00And if we wanted to, we could change the title there so it says exactly that.
09:04Instead of Employee list, we could go in, once again override, Most recent
09:10employee with a photo, and Apply.
09:14Save, and there we are.
09:17We've only covered pages and blocks so far.
09:19If we go in and edit the view, you'll see that there are a lot of other kinds of
09:23things we could add, attachments, feeds, and references.
09:27We'll talk about the attachments in the video, Creating Multipart Views using Attachments.
09:32As you can see, a single view can serve multiple purposes varying not only in
09:36whether it's a page or a block, but also in the fields it contains, how it's
09:39sorted, and so forth.
09:41So you might ask, why would you ever need to create more than one view, couldn't
09:45you just put all of your data display needs into one?
09:48And the answer is, actually, you can.
09:51It's your decision whether to split up data display tasks among multiple views
09:55or just leave it in a single view with multiple displays.
09:58Usually, it's fairly obvious.
10:00I probably use this view for any display that involved employees, for example,
10:04but this is another way that good planning really pays off when you create
10:08your data-driven site.
Collapse this transcript
Formatting views with grid, list, table, and jump menu appearances
00:00As we've gone through the interface to views, we've briefly touched on some
00:04of the other ways it can present data besides in this Table format that you see here.
00:08Now it's time to dig a little deeper.
00:11As usual, we'll go up and we'll Edit our view.
00:13The settings we'll be dealing with are the ones under this Format heading right here.
00:17Right now, it's in the Table format and if we scroll down to our preview, we see
00:20what that looks like.
00:21We can change it though by clicking the word Table and there we see our other options.
00:26Let's try the Grid format.
00:28We'll click it and Apply.
00:30I'll leave it in its default and say Apply.
00:33Now as we scroll down to the bottom, we see the same information, but it's in
00:37this four-column grid.
00:38And as you saw before, we could change the number of columns.
00:41One interesting thing is now we have labels for all of these things.
00:45You might remember that when we were in the Table format and I'll switch back to
00:48show you that, those were actually our headers.
00:53But when you go into Grid and when you go into some of the other formats, they
00:57show up sort of mixed in with the information itself.
00:59So you'll want to be careful with those labels because in some displays they
01:03look good, in others not so good.
01:05The way that you would change that is in the Field itself.
01:08For example, if we go up here to our First name field, you can remove the label
01:12here or change what it says.
01:14You can also say whether there's a colon after it or not.
01:17But we'll cancel out of that, we're not actually going to make that change.
01:20Let's go back up and take a look at some of those other formats.
01:23Click Grid and take a look at HTML list and Apply.
01:27Apply once again, we'll just accept these defaults, and scroll down and take a look.
01:31The only difference between this and the unformatted list you might notice is
01:35that there is this little HTML bullet before each one of these.
01:39This format works best when you have only a few fields, but it can actually work
01:43to very good effect in that case.
01:45Now let's go back and take a look at what other options we have.
01:48We click HTML list and there's this one Jump menu.
01:51This one takes a little preparation.
01:54So instead of making the change here, I'm going to switch this back to a Table,
01:58return all of our sortable items, just so that we can go back to the way that
02:01we were, and Apply.
02:03Just want to make sure that we have something that we can come back to.
02:06Yep, that looks the same as before.
02:08I'm actually going to add another Page display.
02:11When you add a page, it tells you that you need to have a path for that page.
02:15That's okay, I'll just add it down here, and in fact, I'll call it jumpmenu and Apply.
02:21To make that take, I'll click Save, and then I'll go back and edit the view again.
02:27And here we are back at the Jump menu.
02:29I'm also going to change the name of this display which I can do right up
02:33here, just so that I know it's the Jump menu and I don't confuse it with the other page.
02:39There, much better.
02:40The Format of course is Jumpmenu and Apply.
02:43Now we'll leave the settings as they are.
02:45I'll apply that and save it and go to my page, jumpmenu.
02:49I'll do that in a new tab.
02:51Oh, there's our menu, but what a mess!
02:54It just shows all of these fields in one thing right here.
02:57So clearly, we didn't configure it right.
02:59We'll go back and do that now.
03:01Let's say that what we really want is a menu that lists only employees' first
03:04names and then jumps to the page of whatever employee we select.
03:08For that, we need to remove all the fields except for the first name and then
03:12add a special field which has only the target URL.
03:16Fortunately, both of those are easy.
03:18We'll go down to Fields, make sure we're on our Jumpmenu display, and
03:21we'll start to edit.
03:22Remember, the first thing we do is to override.
03:25We Apply and make sure, yep, our fields are overridden.
03:28Now I'll get rid of everything except for that First name.
03:31Click rearrange and start deleting, and then Apply.
03:36Now we'll save and if we go back to that page, you'll see it looks a little bit
03:39better, it just doesn't do anything yet.
03:41Go back to our page and reload.
03:43Now in this pop-up menu we'll see a list.
03:46But we have to tell that list where exactly we're going to go.
03:49First thing I'm going to do, by the way, is I'm going to remove this Pager
03:53because on the Jump menu, we want to make sure that we show everything.
03:57So I'll change it to 0 for no limit and Apply and I'll actually just remove the
04:01Pager entirely, Display all items and Apply.
04:05Now we have to go back to our Fields and add the jumpmenu link.
04:08I click Add and add the field called Path and there it is.
04:12This is a special one which works well with Jump menu, Add and configure and
04:17we'll exclude it from the display.
04:19If we don't do that, it actually shows up in the menu, and then Apply.
04:23Then we'll go back up to our Jump menu and format it.
04:26So the Path field is going to be the path, we have a few other things here, that
04:31all looks good so we apply it, and let's save that and take a look.
04:34Go back to my page and reload.
04:36I choose the menu and there we are.
04:40If we choose Eli and say Go, it takes us to Eli's page.
04:44There's one last thing I want to do.
04:46You might notice in this menu that we have that First name label in there.
04:49You already know how to change that.
04:51We go back in, make sure we're on Jumpmenu, and remove the label from First name.
04:56Apply, Save, and then just to be sure, we'll go back and take another look. And there we go!
05:03We can now go to any of those pages just by using this Jump menu.
05:06Isn't that a neat trick?
05:08So that's all of the formats available.
05:10There's one thing I didn't mention which is that each one of these formats, Jump
05:13menu, HTML list, Grid, and so forth, they have their own settings.
05:19If we cancel out of here, you'll notice next to Jump menu is a group of Settings.
05:23We saw this a minute ago, the one that we've talked about earlier in the course
05:27is reflected in our Page.
05:29The Page you might remember is a table.
05:31Oh, but as I go back, you'll notice that I made a mistake.
05:34I forgot to override when I went to Jumpmenu.
05:37So I'll go to Page, I'll click on Format:
05:39Jump menu, and I'll change that so it's only This page, and then change it back to a Table.
05:46Once again, you always have to watch out for that override.
05:48If you don't, you could end up making the same mistake I did.
05:51I'll Apply and then go through and I have to redo all of my settings again.
05:55I'll make it sortable by everything by the Employee photo and Apply.
05:59While on there, I'm also going to make sure the Block is okay.
06:02Yep, the Block is still in an Unformatted list, so I'm okay there.
06:05I'll scroll to the bottom, there's my block, that looks the way I want it.
06:10Take a look at the page, that's the way I want it.
06:13All good, so I'll save.
06:14I find it really amazing how much power and variety is hidden behind this little
06:18format tag right there.
06:21And others become available as you add modules.
06:23For example, a Map format appears after you install the GMap module and you'll
06:27see that in the video, Displaying Custom Maps.
06:30As with many parts of the view's interface, I recommend spending some time, just
06:35playing around so that you can learn its ins and outs.
06:38That's a great way to get inspiration as well as education when you're building
06:41a data-driven web site.
Collapse this transcript
Rewriting field output for interesting results
00:00We're pretty far along in arranging presentation of our data-driven site now.
00:04You've seen how to show only the data you want, you've seen how to let
00:07visitors select subsets of that data, and you've seen how to present it in a variety of forms.
00:12But we can still make it even better.
00:15Up until now, we've looked at these fields individually.
00:17One result of which is that we have this first name and family name split up
00:21into two different columns, but most lists of names stick those two together,
00:25and that's what we're going to do in this video by rewriting the output of those two fields.
00:30To get started, as usual, we go up and Edit our view.
00:34We're going to rewrite the Family name.
00:36We could also rewrite the First name, but let's start with the Family name.
00:39Later on, I'll explain the difference as to whether you edit the first one or
00:42the second one, because it does actually make a difference in views.
00:45But for now, we'll go to Family name.
00:47We want to rewrite this, so we scroll down to Rewrite Results, and click to open
00:51that group and check Rewrite the output of this field.
00:54I'm going to do something very simple and actually very silly.
00:57I'll just make every one of these say, Hello world!
01:01just so you can see how it works.
01:02I apply, and then I scroll down to the bottom to see, and indeed, now
01:07everybody's Family is Hello world!
01:09Let's go back up, and make it do something actually useful.
01:12I click Family name again, and scroll down to the Rewrite Results.
01:16You'll notice as you go down that there are these Replacement Patterns.
01:20This is where the magic actually happens.
01:22I click to see them all, and we see all of the tokens that are available to us.
01:26Now I've to be honest here, I'm often baffled by the many extra fields in this area.
01:31For example, we have field_last_name- value and field_last_name-format, and
01:36sometimes, we may have other ones that really don't make very much sense at first.
01:40My practice is to try the simplest ones first, and then go on to the complex
01:44ones only if the simple ones don't work.
01:47Anyway, let's go forward.
01:48I'm going to make it field_first_name, copy that, go back up and replace it, and
01:54then I'll do the same, space, field_last _name, which if you scroll down, you'll
01:58see that's the same pattern. Then we apply it.
02:03Now, if we scroll down, it gives us exactly what we want;
02:07Francesca Bueti, all in one group.
02:09There are few strange things about this though.
02:11We've the First Name showing up in a separate column, and then this Family Name
02:16is the complete name.
02:17So one thing I'll do and this one will be easy is I'll change Family Name to Full Name.
02:21Go back up to Family name, and simply change the label, and Apply.
02:27Then we need to get rid of this first name, but you might remember that we went
02:31into the Family name, and we rewrote it.
02:33We only saw those parts that had come before it in this list of fields here.
02:38That's why it's important which order you do this in.
02:41You always change the rewrite of the field that appears last.
02:45See down here we have only in our Replacement Patterns employee_photo, first and
02:49last name, we don't have Department, Job or Location, because those come after.
02:54So we can't actually delete the First Name because that will make it disappear
02:57from the selection list.
02:59Instead, I'll cancel out of here, and go back to my First name, and this is
03:03where that Exclude from display checkbox comes into play.
03:06The View loads up the information but then doesn't show it on the page.
03:10I check that and Apply, and as I scroll down, it works exactly as we like.
03:15One peculiar thing about this is when we click on Full Name, how exactly is it going to sort?
03:20Will it be by first name or last name?
03:22We see that it's actually by last name which can be kind of confusing.
03:25So I'm going to remove the sort option on that.
03:28You might remember that we have that in our Table Settings.
03:30So I'll just go over to Full Name and remove that sortable checkbox and Apply. Scroll down, yup!
03:36It looks exactly as we want.
03:38The last thing we do of course is to save it and then see how that looks on our page.
03:43Yup! Looks pretty good.
03:45Again, this video is just an introduction to the power of rewriting fields, but
03:49I'm sure you can see that this opens the door to a lot of possibilities.
03:53For example, we just put a space between the first name and last name, but you
03:57could do a whole lot more.
03:58For example, you could insert an entire form letter of static text or put in
04:03HTML code or even programming code between the name and an ending of a letter.
04:08I'll show you an example with HTML code in the next video Creating multipart
04:12views using attachments.
04:14Once you know how to rewrite fields like this, a whole new world of data
04:18combination tricks opens up to you.
Collapse this transcript
Creating multipart views using attachments
00:00We've now built a few views, first and most obvious, we have this page of
00:04employees, then we also have this block on the side, plus you might remember we
00:08also created a jump menu page which we stashed away at /jumpmenu.
00:15Now, we'll really start having fun by combining them altogether.
00:19We do that using something called Views Attachments.
00:22I'll demonstrate that by putting some more names down below this
00:25employee's photo here.
00:26It'll show the five most recently hired employees regardless of whether or
00:30not they have a photo.
00:31To start, as usual, we go up to Structure, and edit our view.
00:35Click Views, and Edit.
00:37So that we can see what we're doing as we go, I'm going to open up that front
00:40page in another tab.
00:42Then as you can see, this is the part that will be changed, but let's get back to our View.
00:46We're going to add something called an Attachment.
00:50When we do that, it's going to base the attachment on the master display.
00:53So we're going to have to look through here and change anything that we want to be different.
00:57Remember to override when you do, or you'll change all of the other displays
01:01that are based on that master.
01:02When we scroll down to the bottom we don't actually see anything here.
01:06I see, it's because the master is a Jumpmenu.
01:09I'll change that by clicking it, Overriding, and going to an HTML list.
01:13It's just going to be a simple list of people.
01:15So I think that's the right one to use. Then I Apply it.
01:19Great!
01:19Our attachment is overridden.
01:21We know because it's in Italics here, and it's an HTML list.
01:25I'm also going to override the fields.
01:26We only need to show a few little things.
01:29So I'll go into one of them, Override, and Apply to make sure that
01:32the overriding works. Yup!
01:34It does.
01:34Then I'm going to delete all of them except for the First name and Family name.
01:38I do that by clicking Rearrange and then just removing all the ones I don't want and Apply.
01:43When I scroll down to the bottom, I still don't see anybody.
01:47I have all of these extra filters, so I'll also remove those.
01:50Once again, I Override, Apply, make sure that I'm working on the Attachment of
01:54course, and then just remove the ones that I don't want;
01:57the Department, the Job, and the Location.
02:01Now if we scroll down, now we see more information, and in fact, we see the Full Name.
02:06We actually change the Family Name to show the Full Name in the video Rewriting
02:10field output for interesting results.
02:12The only other thing to change is to remove this Full name title.
02:15I go up here to Fields, click Family name which is where we have the rewriting
02:19remember, and I'll just remove the label and Apply.
02:23Now it's showing what we want.
02:25The next thing to do is to change the sort order, so we see the most recently
02:29hired employees at the top.
02:30In our case, we post them as we hire them, so that would be the most
02:34recently posted ones.
02:35We'll also limit this to five.
02:37We go up here to our Sort Criteria.
02:39Once again we override to make sure we don't change any other displays and Apply.
02:43Then we can remove the ones we don't want.
02:46Remove Family name and First name.
02:48I should mention that although this video is about adding attachments, the sort
02:52of thing that you see me doing now is typical when you start playing around with views.
02:56You're going to have to do a lot of this kind of administrative work to make
03:00sure that your View shows exactly what you want.
03:02The good thing is that Views gives you the power to make those changes, and as
03:06you see, you actually get pretty good at them, so you can do them quickly.
03:10Let's go back up and show only five items.
03:13Change the Pager, make sure it's overridden and change it to five.
03:17I want to mention here we also have an Offset.
03:19Sometimes with attachments, you'll show, for example, the first photo followed
03:23by the next four people, but you have to leave out that first person.
03:27What you would do is then say Offset by 1.
03:30In this case, we're doing something slightly different, so I'll say that's fine,
03:33just five, and there it is, our five most recent employees.
03:37Now comes the fun with the attachments.
03:40We go up here, and before we do anything else, I'll save to make sure we're
03:44okay, and I'm going to attach it to that block.
03:48So first, I'll say, Attach to Block and Apply.
03:51Then I'll save once again.
03:53Now down here, we don't actually see any difference in the preview because it's
03:57showing only the attachment.
03:59If we go back to our page however, and reload, we see that it is part of
04:04that block, and if you can see, there's a sort of gray that goes around that block area.
04:08So we know it's actually in that block.
04:11We want this to appear afterwards though, and we want to put a label on it,
04:14so it's clear that these are the most recent employees regardless of whether they have a photo.
04:19So I'll go back to my View, go back up to my Attachment Settings, and let's see,
04:23there we go, Attachment position, we'll put that After the block;
04:28Apply, Save, and check it out. Better already.
04:32Now, I'm just going to put a little text here, and I'll do that by adding a header.
04:37Once again, we've to make sure that we override.
04:39It will be a Text area, just a simple piece of text, Add and configure, and Override here.
04:45Then I can put in some text here.
04:48Let's say, Most-recent employees, even those without photos and Apply.
04:55We'll save it, take another look and reload.
04:59Looks pretty good, except there's not enough break between this photo I
05:03think and that header.
05:04I can do that using some HTML.
05:06Go back in, go back to my Header, notice it is overridden, we see it by the
05:11Italics, and change the Text format to Full HTML.
05:15That way, I can do such things as put in a break tag and a line right there, and
05:22then at the end I could put in another break tag, and Apply.
05:26We save, take another look and reload. I like that.
05:31I think that's exactly what we need.
05:32I'm going to leave this as it is, but as you can see we could continue doing all
05:37sorts of things with this attachment, including using tricks that you saw in
05:40rewriting field output for interesting results.
05:43For example, we could link each of these employees to their page just as we have
05:47this photo linked to Tom's page, but I think that's enough for now.
05:51Now I know that we did a lot of monkeying around in this video, and it was
05:54ostensibly just about adding an attachment.
05:56But I've found that, that's usually the way it works out.
05:59The Attachment part is comparatively easy, but first you have to get the
06:02pieces in the right shape individually and then once you put them together,
06:06they all make sense.
Collapse this transcript
Styling the output of views
00:00Drupal uses a combination of systems to present information to the world, most
00:04notably Cascading Style Sheets, or CSS.
00:07The essence of CSS is that page elements are tagged with styles, whose
00:11appearance you then alter with code.
00:14CSS is a huge subject and of course lynda.com has over a dozen courses about
00:19it, along with a course specifically about Drupal Theming that shows you how
00:22Drupal implements CSS.
00:24Obviously, I'm not going to recap that information here, I will just assume you
00:28know it and focus on how to apply CSS to data elements through views.
00:32If you don't know CSS, then naturally, those courses are the place to learn.
00:36The first thing that I recommend is that you get a free tool called Firebug at getfirebug.com.
00:42It's a plug-in for the Firefox Browser that's used by literally every
00:46Drupal designer I know.
00:47You can style CSS without it, but Firebug helps a lot.
00:50I will be using it throughout this video and, in fact, I already have it installed.
00:54You can tell from this little bug up here in the corner.
00:57Now let's take a look at our view.
00:58We will start by doing something very simple.
01:01We will make the Full name field bigger than the others, this one right here,
01:04and we won't even have to change our CSS to do it.
01:07So we will go up and Edit the view, and then go down to the field we want to affect.
01:13You might remember that we combined our First name field with the Family name
01:16field in an earlier video, so it actually lives in the Family name here.
01:20I click it, and then I can edit that field's display settings.
01:24I go down to Style Settings.
01:25This is where you make all of those changes.
01:27Now, before you do anything else, remember to override, otherwise you'll make
01:32this change on all of the displays.
01:33So I do that, and Apply.
01:35And then once again I'll go in, make sure that I have this Italicized, which
01:39means I am overriding on my page;
01:41go in and Style Settings.
01:43I can do this very simply by customizing the field HTML.
01:46I check this box, and then I can add HTML elements.
01:50I will change it to H1, just to show what would happen, and Apply.
01:53Then when I scroll down to the bottom, we see how it looks.
01:56It's changed that Full name to H1.
01:58So that's the easy way to do it.
02:01But let's do it using CSS.
02:03We will go back up and click on our field, Family name, and once again, we go
02:08down and click Style Settings.
02:10In this case, we're going to have to customize our HTML just a little bit.
02:13We're going to have to add the SPAN tag, which shows that a CSS class is coming.
02:18We then click Create a CSS class.
02:21The only option you have here is to add the name of a class, because we're
02:24actually going to be editing a CSS file to make this change the style itself.
02:29I am going to call this full- name-altered, with hyphens.
02:34Before saving this, I just want to point out that you can also customize the
02:37label, that is, remember we had the Family name at the top of the table, and
02:41also when we change display, it shows up in different places.
02:44So there are several things you can do here in the Style Settings.
02:46But for us, I am just going to go down and Apply it.
02:50Now when we go down, it's back the way it was, we removed the H1 and we added a
02:54SPAN tag, which doesn't actually change the appearance at all.
02:57I am going to go up and save this view because we're going to go on and do a few other things.
03:02Now we've defined the CSS class, but we haven't yet styled it.
03:06In Drupal, the cleanest way to do that is to edit a CSS file that's part of the theme.
03:10So I created a copy of Bartik, that's the theme that you see here, and called it unbartik.
03:15I put that in the sites>all>themes folder.
03:19If we go there, you can see my installation on the Desktop. Open it up.
03:24We have sites>all>themes, and there is unbartik.
03:28Inside there I added a folder inside the CSS folder called local.css.
03:33I will open that up in Notepad so you can see.
03:35Right now, there's nothing in it.
03:37If you have the exercise files to this course, you'll find it there already.
03:40If not, you can learn how to create a theme by watching the Building Themes the
03:44Traditional Way Video in lynda.com's Drupal 7 Essential Training Course.
03:49Now, because we know the class, we can style it the usual way, but first, I am
03:54going to go back to our site and switch over to that UnBartik theme.
03:58We do that by clicking Appearance, scrolling down to the bottom where our
04:02UnBartik theme is, and Enable it and set it as the default.
04:06Then we close the Overlay.
04:07You'll notice that there's no difference between this and the one we just came
04:11from, because it's really just a copy of the Bartik theme.
04:14But let's go back to our Text Editor.
04:16Now we'll add the CSS style that will change that Full name.
04:20The style we want is .full-name- altered, remember that's the name of the
04:25class, open the brace.
04:26I will make it font-size:
04:281.5em, and font-weight:
04:33bold, some very simple styling there.
04:36I will close the brace and save it.
04:38Now when I go back to my site and reload the page, we see that indeed, the Full
04:42name did show up with our styling.
04:44If it doesn't show you the styling that you expect, there are a few things
04:47that could be wrong.
04:49One of them is that your CSS might be cached, that is, your server might be
04:52holding onto the old stuff and not giving you the new stuff.
04:56To change that, go up to Configuration, and down to Performance, and Clear all caches.
05:02This may take a while.
05:03The other thing to look out for is Aggregate and compress CSS files.
05:07If this is turned on, turn it off first and then clear your cache.
05:11That will usually allow all of the new CSS changes to come into your site properly.
05:15This is of course just the tip of the iceberg in two ways.
05:19First, our example was extremely simple.
05:22CSS as a whole includes methods for adjusting layout as well as styling, which
05:26multiplies the possibilities.
05:28For an example of the range of CSS possible, I recommend visiting CSS Zen
05:33Garden, which is at www.csszengarden.com.
05:38But when you do, prepare to have your mind blown, it's an amazing site.
05:42What CSS Zen Garden is, is it shows the same site, but with different styles.
05:46Like let's take a look here.
05:48It's the same site, just once again with different CSS applied.
05:51So you can see the enormous amount of difference you can do with just a little
05:55bit of CSS styling, or in this case, a lot of CSS styling.
05:58The second way that what I've showed you is just the tip of the iceberg is
06:01that you can gain a lot more control over data styling by learning the ins and
06:05outs of Drupal Theming.
06:07For that of course, see lynda. com's videos on Drupal Theming.
Collapse this transcript
6. Learning Views' Advanced Options
Importing and exporting views
00:00Once you start creating views, you'll find that you want to reuse them in other sites.
00:04Fortunately, views lets you export what you've created and then import it elsewhere.
00:09It works as advertised, but there are some tricks to watch out for.
00:13I am going to show you how to do it by exporting our Employee List View.
00:16Then we'll attempt to import it into another site.
00:19In this case, we'll move the data to a site that I've just installed and then
00:22added the necessary modules to.
00:24That is, Views, CCK, and Chaos tools.
00:27The process isn't going to work at first, I have to warn you, but by fixing the
00:31problems, you'll learn how to avoid them.
00:33If you'd like to follow along at home and need some help installing modules or
00:36the new site, see the relevant videos in lynda.com's Drupal 7 Essential Training course.
00:42But let's get back to our source site here, Two Trees.
00:45As usual, we go up to Structure, and Views.
00:48From here, there are two different ways that you can export the view;
00:50either from this list of views by using this pop-up menu here, Export.
00:55That gives you a long text file.
00:57This is actually the way that you do it.
00:59You simply copy text over to the new site.
01:01The other way to do it, if I go back one, is to go into the view itself by
01:05clicking Edit, and then from here under the edit view name/description, there is
01:09another pop-up menu which gives you the same thing, export view.
01:12I am going to copy that by clicking in the middle of the field, selecting all,
01:17and then copying, and then go over to my new site, which I called New Trees
01:20instead of Two Trees.
01:22I will go up to Structure, and Views, and then click the Import link.
01:26Once there I simply paste the code into this field.
01:29You don't actually need a name, because that will carry over from the old site.
01:33Now, I have to tell you before I click Import, this isn't going to work.
01:36So don't worry, we'll see a lot of errors, and I'll explain what they are.
01:40In fact, they are your errors.
01:42This is all caused by the same thing though.
01:45You might remember that we set up a lot of custom fields in our old site.
01:48If we go back to our front page you can see them;
01:50Photo, Department, Job, and so on, and then this Full name is actually a
01:54combination of two fields;
01:56First name and Last name.
01:57None of those fields exist in the site that we're exporting to.
02:01So it takes all this information, but it doesn't know what to do with it.
02:04So it just throws an error.
02:05To get past this, I am going to quickly set up a very simple view that will
02:09export only the first and last names.
02:11Then I will go to the new site and I will create those fields, so that they can
02:15catch all of the data that are coming off of this old site.
02:17First, we go up to Structure, and Views, and Add new view.
02:23I'll call this Employee names only.
02:25It will be Content of the Employee type, and then I will just ignore the rest.
02:30We don't really need to mess around with Page and Block and that sort of thing.
02:34Click Continue & edit.
02:35This is where I will make the usual changes that I like to do to views.
02:38For example, I will change it from an Unformatted list to a Table.
02:42I will leave the defaults, and then go down to my Fields.
02:46This is where I will add my first name and last name, which you might remember
02:50we changed the label for to Family name instead of Last name, Add and configure
02:55fields, and I will just accept these defaults.
02:57If I scroll down, actually it looks basically the way that I want, I will put
03:01the First name before the Family name, but otherwise it's basically what I want.
03:05Click Rearrange, First name before Family name, and Apply. Good!
03:09Now, remember to save, it's very easy to forget this.
03:13So there is our Source View.
03:15Now I am going to prepare the target site so it can catch all that information,
03:19but before I do that, I want to take a look at that content type and make sure
03:22that I have the Source Field names correct.
03:25I click Structure, and content types, and then Employee, and manage fields.
03:30The two fields I want are First name and Last name, and the full field name is
03:35field_first_name, field_last_name.
03:38You might notice that we never actually typed in the word field, that's just
03:42something that Drupal adds whenever you create a field.
03:44So all we really need is this First name and Last name.
03:47Note also that Last name is what we want, that's the machine name, not the
03:51label, which is Family name. Okay.
03:54Enough warnings.
03:54Let's go over and go to Structure, and content types, and create a new content
03:59type in our target site.
04:01This one should have the same name, which is Employee, and I'll just leave all
04:05the other settings as they are, and add my two fields;
04:08they're First name, and that's a Text field, and I will just click through so
04:16that I save all of the defaults as I did in my original site.
04:19And then Last name, which you might remember the label is Family name, but the
04:24machine name is last_name, Text, Save, and click through.
04:31Now we're ready to move our view.
04:33I go back to my source site, go back to my views, Structure>Views, go to my
04:38Employee names only, that's the one we're moving over, and Export.
04:43I select all of this text, and then go to my new site, go to Structure, and
04:48Views, you've seen this part already, and Import.
04:52Then I paste my code.
04:53If this was all done right, when I click Import, I shouldn't have any errors,
04:58and indeed, it worked.
04:59We can see down here we have Title, First name, Family name, and we click
05:04Save to make it final.
05:06As we scroll down however, you might notice we don't have any data there yet.
05:10That's because we set up the view, we didn't actually import any of
05:13the information itself.
05:15But since we didn't get any errors, we know that it's probably okay, and we can
05:19test this actually by adding some content.
05:21Let's add an Employee, the Title would be the employee number, and then we have
05:25our First name and Family name, scroll down, and Save.
05:30If we go back to our View now, edit it, and look at the preview, and there it
05:36is, Jim Thompson, just as we expected.
05:38So now you know what I meant when I said that exporting and importing views can be tricky.
05:42But it really does work, and it works well when you've done enough preparation.
05:46It works especially well as a way to get multiple people working on the same site.
05:50They can work on different things and move views from one development
05:53environment to another easily.
05:55Going one step further is a module called Features, which you can find at
05:59drupal.org/project/features.
06:01Features provides a way to move not only views, but also content, content types,
06:07and a host of other things from one site to another.
06:10However, it's a much more complicated system.
06:13For circumstances where your needs are specific and fairly modest, the Import
06:17and Export functions of Views do all that you need.
Collapse this transcript
Controlling access to data
00:00So we've created a list of our employees, but is that really something we want
00:05to make available to the whole world? Probably not.
00:08So I am going to make some changes to limit our access to it.
00:11Now, before I start I should mention that limiting access to a view is only one
00:15part of the security solution.
00:17The information will still be available and visitors will be able to find it
00:20by searching, but I will also point you to some resources for fixing those problems.
00:25To show this we need to look at our site as if we were a casual visitor.
00:29The way I did that is by opening a different browser program, not just a new
00:33window, but an entirely new program.
00:35So I am looking at the site as an administrator here in Firefox, but then if
00:39I switch over to Google Chrome, you can see that I'm looking at it as if I'm
00:42a visitor, and we know that I'm a visitor because we have this User login over here.
00:46Another way to tell in Drupal is by typing user at the end of your domain.
00:51If you get this Login box, that means that you're not logged in already,
00:55whereas if I am a logged in user and I'm switching back here to Firefox, I see my own profile.
01:01A visitor who is not logged in is called an anonymous user in Drupal speak.
01:06Those who are logged in are called authenticated users.
01:09Anyway, let's go back to our Employee list and start limiting access to it.
01:13As usual we go up and we Edit the view.
01:16Right now, we're just looking at the Page View, and you will notice that there's
01:20something under Page Settings for Access.
01:22We can limit Access either by Permission or by Role, and as you can see, we can
01:26limit it just to this display or to all displays.
01:29I will briefly explain the difference between Permissions and Roles, but for the
01:32full details see Drupal 7 Essential Training from lynda.com.
01:36For us, I am going to change it to Role, and then Apply.
01:40We then have a choice of which roles we want to allow to see this page, and in
01:43fact, all of the displays.
01:45I am going to say that we only want authenticated users and the administrators
01:49to see it, not the non- logged in anonymous users.
01:52In fact, I will do that for all of my displays.
01:55So I do that and click Apply.
01:58We Save our view and then let's test it.
02:02Since we are an administrator, we can still see this both in the list and then
02:05in the block down here, but if we switch over to our Chrome browser, go back to
02:09the front page where remember we usually see a view. Access denied.
02:14In fact, that block has also disappeared from this left column. So it works!
02:18That's just the basic solution, but there's a big problem with it.
02:22Each one of these records is a node in Drupal and we haven't actually limited
02:27the access to those nodes.
02:29If our visitor happens to know Drupal pretty well, they know that if they simply
02:32type node/ a number, they will get one of the nodes in the site. Let's try node/1.
02:38Yup!
02:39This visitor can still see the private information of poor Dani Smith and,
02:42furthermore, the data is searchable.
02:45I can show you that by going back to the administrator site and giving that
02:48anonymous user the ability to search.
02:50It's not there by default, but many sites turn it on.
02:53We click People, and then go up to Permissions, and then scroll down until we
02:57get to the Search group, which is way down near the bottom.
03:00Let's let them use Search and Save.
03:04Now if we go back to Google Chrome and reload, we see a search box.
03:08If I do a search, for example, for office, holy cow, I see everything.
03:13I see people who work in the front office, in the back office, suddenly I still
03:16have access to all the stuff.
03:18So you not only have to hide the view, but also the information itself.
03:23There is a nuclear option for doing that.
03:25You could simply turn off access to all content.
03:27I will go back to my administrative page and scroll down this list of Permissions.
03:33One of the permissions is View publish content.
03:36If I turn that off and Save, then I can go back to my site and reload.
03:41They can't see anything.
03:43If I were to try /node/1, I again get Access denied.
03:49But in our case I am just going to go back and re-enable that permission.
03:52We may be using it later in the course.
03:54So View published content, I will let them see it again.
03:57I'm also going to turn off that Use search, just for safety's sake.
04:02Save permissions, and if we go back to Chrome, we are back the way we were.
04:07We can see individual nodes, but we can't search for them.
04:10There are several other ways that you can hide this content from anonymous users
04:14and some of them give you a lot more control.
04:16If you want to see them, go to the drupal.org Modules page.
04:19You will find that at drupal.org/project/modules.
04:23Once there, Filter by the version of Drupal you have.
04:26In our case it's Drupal 7.
04:28Then under Categories look at Content Access Control and search. Wow!
04:3340 Modules that let you limit the access.
04:36The one that I'm going to show you very quickly is called Nodeaccess.
04:39You might find that one of the others fits your needs better, so don't be shy
04:42about looking around and trying all of these if node access doesn't do what you want.
04:46It's at drupal.org/project/nodeaccess.
04:48I'll scroll down and install it the usual way.
04:56Right-click on the gz file, Copy it, go back to my site, Modules, and Install. I then Enable it.
05:07Scroll down until I see it in the Other group.
05:09I Enable it and Save.
05:12When you've done that it gives us a warning.
05:14We have to rebuild permissions.
05:16So I'll go ahead and do that, and then we go on to configure it.
05:19Click Configuration and Nodeaccess.
05:22The one that we want to control for is Employee.
05:25So I click that link and remove the View permission from anonymous users. It's that simple.
05:30Go down and Save Grants.
05:32Once again we rebuild permissions and now we've blocked all the access that we
05:37had before for anonymous users.
05:40If we were to try to go to node/1 again, nope, still Access denied. Terrific!
05:46We've now installed basic data protection on our site, but if the information
05:49is really important, you can't stop there, because there are still some potential holes.
05:54For example, we haven't prevented other roles from accessing employee
05:58information, and going even deeper, anyone who can look at certain files on the
06:02server will be able to get all of that data as well.
06:05Fortunately, the Drupal community has really stepped up to the plate and
06:09provided a lot of information about security.
06:12Your first stop, as always, is drupal.org.
06:16Once there, search for security.
06:19To narrow it down further, you can take a look at some of the groups available
06:22by clicking here, Best Practices and so forth, or you can look at the
06:26documentation, Securing your site, that's a good place to start.
06:30If you prefer books, Cracking Drupal puts it all in one place.
06:34You can learn about that book at crackingdrupal.com.
06:39But for most data protection purposes the lessons you saw in this video
06:42should be enough.
Collapse this transcript
Adding dynamic filters to views
00:00You already saw how to select records to display in the video, sorting and
00:04filtering data, but the tricks you saw there only take you part of the way.
00:08They let you filter based on specific criteria.
00:11In our example, they only show records of employees.
00:14Now, I am going to show you how to use Filters that are a little bit more flexible.
00:18Drupal calls from Contextual Filters because they vary based on what's currently
00:22showing on the site.
00:23That is, on their context.
00:26As usual, it becomes clear when you see it in action.
00:28So let's get started.
00:29We are going to implement a filter similar to this Department Filter, but
00:33instead of being a simple pop-up list, it will be passed through the URL.
00:38To get started, we will go to our Views; Structure>Views.
00:43The one we are going to use is the view we were just looking at, Employee list.
00:46I am going to do a lot to this view, and then I'm going to delete it at the end of the video.
00:50So first, I'll clone it.
00:52That way we can do whatever we want and we can be sure that we still have our original copy.
00:56I will keep the view name as Clone of Employee list and continue.
01:00Before going on, I want to make one small change.
01:03I want to edit the page, so that the path to that page instead of being
01:07employee-list, that's the same as the other one, it's simply test.
01:12That way, we can see what we're doing a lot better, and then I will save.
01:16So that we can keep an eye on it, I'll open up that page in a new tab. There it is!
01:21And as you can see, it's simply /test.
01:25The area that we're going to be playing with is this Contextual Filters over
01:28here which is in this Advanced Group.
01:31Now by default, Drupal shows this as collapsed like that.
01:35If that's the case on your computer, then it's easy enough to show, just click
01:38this link here, and you'll see it.
01:40In the video Changing views administrative options, I showed how to change a
01:44setting so it's always showing.
01:46To go forward, I am going to add a Contextual Filter.
01:49The one we'll add will be Department.
01:52That matches the filter you've already seen.
01:55We add it and I'll just accept the defaults.
01:58However, I will make it only affect this display.
02:00So I will override and apply.
02:03Now, if I scroll to the bottom, I see one change.
02:06There's this preview with contextual filters, but the rest of the preview
02:10is exactly the same.
02:11The way this works is if I type in the name of the department into that field, I
02:15will able to see only people who work in that department.
02:19So let's try, for example, Back office and Update preview and there they are;
02:26only the people who work in that department.
02:28If we save this and go back to the View itself, we reload the page, and we
02:33actually don't see anything different.
02:35What changes is what you type in the URL.
02:38If I were to say field here, for example, we see only those people who work in the field.
02:43That's great as it goes, but it requires users to manually type something into
02:48the URL and furthermore, they have to know exactly what to type.
02:51Fortunately, we can change the settings on this Contextual View to make it
02:55more user-friendly.
02:56But first, we're going to have to wipe out some other things we did earlier in
02:59the course, because they get in the way of our Contextual View filtering.
03:03We will go and edit the view.
03:05I am going to remove some of our other filter criteria.
03:09First, I'll go in here and override, so I don't change any of the other
03:13displays and apply. Now, I'll go in.
03:16I'll remove the exposed department filtering.
03:19Make sure it's overriding and remove.
03:21I'll also remove the others just for simplicity sake.
03:27We can also remove some sort criteria again to simplify things, but again play around.
03:32I found that sometimes when something isn't working, it's because the View is
03:35too complicated and the more you simplify it, the better you are off.
03:40Try just subtracting a little bit and then a little bit more until you get what you need.
03:44In this case again I am just going to wipe out a few things and make this very simple.
03:49Now, we are ready to go.
03:50We go back up to our department contextual filters and I am going to change a setting here.
03:55Before, as you saw, when there was nothing after our /test, that is, if we
03:59hadn't added a filter into the URL, we saw all of the records.
04:04This time, I am going to show a summary of the records.
04:06I click there and apply it.
04:09If we scroll down, we can see what that does. Ah!
04:13We see exactly how many people are in the back office and the field and so forth.
04:16I will save this and show you what it looks like on our page.
04:20We go back up to our URL and remove field which you might remember is what
04:24was in there before. There it is!
04:27Now, if we want to see everybody who's in the front office, we simply click this
04:31link, and there they are.
04:33You will notice that after we click that link, we see the results up here in the URL.
04:38We clicked Front office and there it is.
04:40There's one curious thing about this kind of Contextual Filter.
04:43You will notice that the summary disappears whenever you click one of the links.
04:47That's because it's only there when nothing is selected.
04:50We can improve its interface a lot by using Contextual Filters in combination
04:54with attachments which you learned about in the video Creating multipart
04:58views using attachments.
04:59In that case, you could keep that directory appear even while it showed
05:03results underneath.
05:04But our group of employees is small enough that I don't really think it's
05:07necessary to go forward.
05:08I am just going to get rid of this Contextual Filter and return the site to the way it was.
05:13I go up, edit the view, go back to my Views, and delete my clone, and delete.
05:21Now, if we go back to our front page, you will remember it's still our
05:25original employee list.
05:27It should be apparent that we really only dipped our toes into what
05:30Contextual Filters can do.
05:32But from the little you saw here, I am sure you can understand how they can
05:35really make record selection dynamic, especially on sites that have a lot
05:39of data.
Collapse this transcript
Extending views with relationships
00:00Now we come to one of the hardest concepts to understand, relationships.
00:05As with Dynamic Filters I'll only be able to give a peek into the vast world of possibilities.
00:10To demonstrate, I'll show what amenities are available at the location where an employee works.
00:16That information is connected with the location because after all, a location
00:20would have a cafeteria, not an employee.
00:23But we want to display it in a list of employees to show what amenities are
00:27available to any given employee.
00:29To do that, I'll have to set up a relationship between the employee, and the location.
00:35We started setting that connection up in the video Connecting two fields using references.
00:40At the beginning of that video, we installed the module references.
00:44If you haven't done so already, you'll need to write now.
00:47You can get it from drupal .org/project/references.
00:52Once we installed that module, we added a reference field so we could store
00:56locations in a Location content type, and then we pointed to those records when
01:00we wanted to show where an employee works.
01:02If we go back to our site, we can see that by going to Structure>Content
01:07types>Employee and manage fields.
01:11We scroll down to that Location Field, we see that it's a Node Reference, and if
01:15we edit that field, we see that it references only those nodes that are of the
01:21Location content type.
01:22There is a problem with this though, that's a very limited sort of reference, it
01:27only carries over the title of those Location Nodes.
01:31So we can see, for example, that Francesca works at the Ventura orchard, but we
01:36can't see anything else about that orchard.
01:39That's true even if we start to add other text fields there.
01:42I'm going to do that and add amenities to those locations.
01:46To do so, I go up to Structure and Content types and I'm going to add a field in
01:51my location content type for amenities.
01:54We'll call it Amenities.
01:55It will be simply a Text field and Save.
02:03We then as usual have a number of options, and in this case, I'm going to allow
02:09for an unlimited number of values.
02:11It's going to be one line after another of different amenities that people can have.
02:16Save settings, and now we're ready.
02:19I'll very quickly add amenities to the three locations we have, we'll go
02:23through this very quickly.
02:25To find them, we filter by Location and there they are!
02:30I'll open each of these in a tab.
02:34In Oxnard, we'll say there is Parking, and a Cafeteria, and an Exercise
02:42room, and then Save.
02:45I'll add similar amenities to the Carpinteria Orchard and the Ventura orchard.
02:50Now, we're ready to add that information to our employee view on the front page.
02:55We'll try the obvious way, but it's also the wrong way.
02:59To do that, we'll edit this view and add a field.
03:06The field will be Amenities.
03:08Now, notice that it says it only shows up in the Location content type, but
03:14we'll add it anyway and see what happens.
03:17We'll accept the defaults and then scroll down and see how it looks.
03:21Well, it added a column, but there's nothing there.
03:23That's because we haven't set up a relationship between the two.
03:26That's what we'll do now.
03:28We'll go back up to the top and save just for safety.
03:31Then we'll go back to our View and edit the Relationships.
03:35Now, most of the relationships here are built into Drupal.
03:40For example, it assumes that there is going to be a relationship between the
03:43author of a post and the post itself.
03:46Similarly, there are relationships between comments on a node and the node itself.
03:51The one that we want to add is this Location.
03:54So we click, and add, and then I'll simply click through and accept the defaults.
04:00Now if we scroll to the bottom, you see that doesn't actually change anything in
04:04our View at all, we still have this blank column.
04:07But we start to see the effects of that relationship when we go back, and add or alter fields.
04:12I go up to that Amenities field again and now we have this extra choice.
04:19We'll use that relationship that we just set up.
04:22Scroll down and Apply it, and scroll down and now we have all the
04:27information that we wanted.
04:29Incidentally, Relationships work not only with fields but also with sorting and filtering.
04:34For example, we could create a filter that showed only those people who worked
04:39at a place that have Truck parking, and if we go up here, and add some Filter
04:43Criteria, let's just choose one at random, Amenities, and you see once again, we
04:51have that relationship right there.
04:52I'll remove it since we're not actually going to do that in this View.
04:56Finally, I'll go up and Save.
04:58We return to our page, and it gives us exactly what we wanted.
05:03The hard part about relationships is knowing when they're needed, and also which
05:07direction they should go in.
05:08For example, let's say that we created a View of locations and we wanted to see
05:13a list of all the people who worked in each one.
05:16You'd need to set up a reverse relationship, something that's not possible with core Drupal.
05:21There are a few solutions to that reverse relationship problem and it's a field
05:25that's currently changing in Drupal.
05:28So rather than recommend a particular solution, here are some resources that
05:32will show you how you can figure that out for yourself.
05:35One of them of course is the site we looked at earlier
05:38drupal.org/project/references.
05:42There is some information linked to this about that one-way and two-way and
05:46reverse relationship issue.
05:48Another project that's related to this is called NodeReferrer.
05:52It's at drupal.org/project/nodereferrer.
05:58Finally, there's a similar project called relation at
06:01drupal.org/project/relation.
06:04With hard work on the part of the modules maintainers, I'm hoping that this will
06:08be settled by the time you watch this video.
06:11In the meantime, you can solve most bidirectional relationship problems through
06:15careful construction of your content types and your views.
06:19As usual, the drupal.org site is the place to get the latest news.
Collapse this transcript
Improving data administration with Views Bulk Operations
00:00Our site doesn't contain very many records yet, so when I want to make a change
00:04to every record about our company's locations, for example, as I did in our last
00:08video, I can just click through and manually edit all three pretty quickly.
00:13But what about when the site gets bigger?
00:16Then I'll really want to start to have tools that will do bulk edits.
00:20Fortunately, such a tool exists for Drupal.
00:22It's called Views Bulk Operations.
00:26You can get it at drupal.org/ project/views_bulk_operations.
00:36I'll download and install it in the usual way.
00:39I copy the link for the .GZ file, go back to my site, click Modules, and Install;
00:48Paste and Install.
00:51When that's done, I enable it.
00:54Scroll all the way down until you're in the Views group at the very bottom.
01:00Then click Views Bulk Operations.
01:03But you can't do it without the Entity Module, so we'll go and get that one as well.
01:08That's at drupal.org/project/entity.
01:12Once again, we scroll down and install it in the usual way.
01:26Now, when we scroll all the way down, we can turn on Views Bulk Operations and
01:30Entity automatically gets turned on.
01:33Views Bulk Operations essentially lets you build your own content management
01:37page, very much like the one that you get when you click Content.
01:41You might remember that we had earlier filtered this, so we saw only Location types.
01:46We can Reset that and show everything.
01:49We can also select several of these, make certain Update Options, Unpublish
01:53them, Delete them and so forth.
01:55There is one thing that I dislike about this page however.
02:00When we set up our employee records, we had the Title field show the Employee
02:04ID, but when I look through this list, I don't know who employee 213 is.
02:07I'd rather see them by name.
02:11So that's what we'll do with Views Bulk Operations.
02:14To make that happen, we create a View.
02:16Go up to Structure and Views.
02:20On this page, you'll notice one of the built-in Views down here is called Content.
02:24This was added by Views Bulk Operations.
02:27I'm going to clone this and then work with the clone.
02:32I'll call it Employees by name and Continue.
02:37If we scroll down to the Preview, we see that it looks very familiar.
02:42It shows our Title, Content Type, Author, and so forth.
02:45In fact, it looks exactly like our Content page, but it was created in View, so
02:50we can now change exactly what it does.
02:53I'll go back up to the top, and take a look at the page.
02:56I just want to see what path it is.
02:58It's /admin/content2; remember that.
03:02We'll save it, and then take a look at that page in a new tab.
03:08You'll notice once again, we have this Choose an operation, but it has a lot of other options.
03:13We can execute an arbitrary PHP script, for example, or Unpublish content
03:18depending on what keywords are in that content.
03:21Also, there are additional options up here for filtering.
03:24This is all done with Exposed Filters which you learned about earlier in the course.
03:28What I'm going to do with this View though is I'm going to add that first and last name.
03:33So I go over and I edit the view just like I do any other view.
03:38Here, I'll add two fields;
03:40First name and Last name.
03:41Type name to find them, there is Family name and First name, and add them
03:47and configure them.
03:49Just for speed, I'll accept the defaults.
03:53If we scroll down to the Preview area, we see how that looks, and actually it's not bad.
03:58Now, we see it by Family name and First name instead of just by number, but we
04:03can do a little better.
04:04First, let's reorder those, and again, this is using things that you saw
04:09earlier in the course.
04:10We'll go up here to Rearrange and drag First name and Family name back up to the top and Apply.
04:18We can also rewrite this so that First name and Family name are altogether in one field.
04:23We click Family name, Rewrite the Results, Rewrite the output, then take a look
04:30at our Replacement Patterns.
04:32We want field_first_name followed by field_last_name and Apply.
04:44Then we'll scroll down and take a look, and we can get rid of this First name.
04:49We'll simply hide it from the View, and Apply.
04:57So it looks pretty good.
04:59But we still have this title here that isn't really necessary when we're
05:02looking at employees.
05:04In fact, we want this to just be a list of employees.
05:07So first, I'll add a filter to get rid of the other node types, and then I'll
05:11find a way to link this, and get rid of this title.
05:15So let's go up and change the Type filter.
05:18Make it so that it's not exposed and that it shows only Employees and Apply.
05:25When you scroll down, yup!
05:27Showing just Employees, and as we do that, we don't need to show the Type.
05:31So I'll scroll up to the Filter, and remove the Type. Looks pretty good!
05:39Now, let's change that link, and then we're just about done.
05:42To do that, we'll have to add a field called Link.
05:46Go up to Fields>Add and do a search for link. There it is!
05:52And Add and Apply.
05:54I'll move that up to the top, and apply once again and see how that looks. That's not bad.
06:07If we continue to play with this View, we could, for example, make this Family
06:11name linked to the record instead of having a View link, but let's leave it as
06:15it is for now after getting rid of the title since it's now redundant.
06:18Go to Title, and Remove.
06:21Just for safety, we'll go up and save it.
06:24I'm going to do one more thing.
06:26I want to change what operations are available from this menu, and that's part
06:30of Views Bulk Operations.
06:32We go up and edit the view, and then we scroll down to Fields, because the place
06:37that those control shows up is in Bulk Operations.
06:41Click it to edit, and then scroll down.
06:45Here, we see that we have a lot of operations available to us, and as you add
06:49more modules, additional operations might become available as well.
06:54For each of these, you have several options.
06:56Again, I won't have time to show you those now, but I recommend that you play
06:59with them just to get it exactly the way you want.
07:04Let's add one, for example, Display a message to the user, and then Apply.
07:11We'll go up and save.
07:13So now we're back at that view.
07:16We take a look at our operations and we have that Display a message to the user
07:21that we had selected before.
07:22Let's say that we just selected this one and said Execute.
07:26Now, we can decide what sort of message would be shown to the user. You get the idea.
07:30This is quite extensible.
07:32In fact, it is possible to add your own custom operations to that list.
07:37There are a few ways of doing that.
07:38If you're a developer, you can write plugins for Views Bulk Operations.
07:42But for those of us who aren't developers, there are some options in the form of
07:46a compatible module that takes advantage of Views Bulk Operations.
07:50If we go back to the Project page, we see this group of Complementary Modules.
07:58All of these work together with Views Bulk Operations to let you change what you
08:03can do to those items on that content page.
08:06Now I know that I went through that fairly quickly, it's just because there are
08:10so many options with Views Bulk Operations.
08:13I like its basic setup, without much customization at all, but of course you
08:16could go very far with it.
08:18One example would be to show all of the employees' photos on that
08:21Content Management page.
08:24A more complex example would be to show only those employees who have a birthday
08:28coming up in the next week, and then you could set a bulk operation to email
08:32them a birthday greeting.
08:34Remember, anything you can do in a View, you can do in a Views Bulk Operations page.
08:39The only difference is that with Views Bulk Operations, you can change the
08:43records that are displayed in that View.
Collapse this transcript
7. Working with Locational Data
Understanding locational data
00:00One of the most visually impressive ways to display data is on a map.
00:04In fact, it's easy to miss that map points or data at all since they're shown in
00:08such a real-world context.
00:11But in reality, they're simply two coordinates.
00:14One shows latitude which is how north or south the spot is and the other one
00:18shows east-west longitude, but there are other kinds of locational data as well.
00:23The most familiar one of course is the street address.
00:27This video talks about how those different kinds of data interact and how
00:31they're expressed in a data driven Drupal site.
00:34Let's start with latitude and longitude, because ultimately every mapping
00:38program translates addresses into those measures.
00:41You can see how that works by going to Google Maps.
00:43That's at maps.google.com.
00:46You can actually enter coordinates indirectly.
00:48Let's try, for example, 38n 123w, and there it is.
00:55As we pull out, we see that we're in Northern California.
01:01We can be even finer than that by using a decimal point, .8.
01:05Let's say .823 and 122.456. There we are;
01:13somewhere else in California nearby.
01:15One interesting application of this latitude and longitude system is something
01:20called the Degree Confluence Project which is at confluence.org.
01:24This is an interesting project where volunteers go around the world and
01:28take pictures at every one of the intersections of the integer latitude and longitude.
01:33So if we go to Afghanistan, for example, we see that people have visited three
01:37of those points, and we can see what they look like.
01:40Anyway, that's just a curious little side note.
01:42The important thing to know is that the degrees are mapped as if they're on a
01:46two-dimensional surface and every spot on earth has that latitude and longitude.
01:51But the thing is if you've ever used a mapping program, you know that you don't
01:55usually enter latitude and longitude when you're looking for things, you enter
01:59a street address or more often, something like restaurants near the Apollo Theater.
02:04The mapping program then converts those prose phrases into map coordinates using
02:09something called a Geocoder.
02:10There are actually a lot of free geocoders out there.
02:14If you go to Wikipedia and then go to the Geocoding page, you see that there are
02:21many geocoding systems out there and some of them are free.
02:25The two that we're going to use come from Google and Yahoo!
02:28and both of those are free.
02:30They do have limits on them though.
02:32For example, Google's limits you to 2500 views per day and Yahoo!'s to 50,000 views.
02:38That's a lot more views, but Yahoo!'s doesn't cover quite as much of the globe.
02:41If that's not enough for you, there are free Geocoders and you can use those
02:45with a module called Open layers.
02:48However, Open layers is much more complicated than the system we're going to show you.
02:52To get to it should you feel so intrepid, it's at drupal.org/project/openlayers.
02:58But we're going to use the easier version, something called the Location Module.
03:02That's at drupal.org/project/location.
03:06So location geocodes are addresses, but that's only one part of the solution.
03:12You also need a way to input the addresses and the Location Module gives you that.
03:17Finally, you need a way to output them as well.
03:19We will be using a module called GMap, which connects with Google Maps.
03:24As you might guess, that's at drupal.org/project/GMap.
03:28Now I have to admit when I recorded the course that was the predecessor to this
03:32one, that is, Drupal 6 Online Presentation of Data, it looked really promising
03:37that soon there would be another mapping solution that was better than the
03:40combination of Location and GMap and there have been quite a few contenders.
03:44You can see that by doing a search on the groups.drupal.org site for
03:48geospatial modules assessment.
03:59You can also follow discussions about all of them on the location and mapping
04:02group on groups.drupal.org.
04:06Finally, it's worth checking out all the location related modules on drupal.org
04:10if you want to go further and try some alternatives.
04:12To get there, go to drupal.org/ project/modules, Filter by compatibility;
04:18we're using Drupal 7, and then choose the Location group under the
04:22categories and search.
04:29But despite this I've found that the old way is still the best one available
04:32using Location and GMap.
04:34If you run into a mapping problem that they can't solve, try visiting these
04:38other resources to learn about the current status of other solutions.
Collapse this transcript
Setting up the Location module
00:00In our last video you saw how locations are merely points that are described by
00:04coordinates of latitude and longitude.
00:06You also heard about the location module which is Drupal's way of converting
00:10location names into such coordinates.
00:13The Location module is pretty complex.
00:16So in this video I will show you how to make the most of it.
00:19The first thing you have to do is get the module.
00:21You do so at drupal.org/project/location.
00:26Once there you scroll down and install it in the usual way.
00:31Copy the link location for the .gz file, go back to your site, click Modules,
00:39Install, paste your URL, click Install, and then enable it.
00:50You'll notice that it actually sets up a whole new group here called Location.
00:57It also adds a CCK field in case you have CCK installed as we do.
01:01I am just going to add a few of these.
01:10Location which is the base module you need in order to enter locations, Node
01:16Locations which associates them with nodes, and Location Search which I just
01:20happen to like, because it gives you some additional search options.
01:24Scroll to the bottom and Save.
01:29The location modules change two things.
01:32First, they make a Location field available to Content types.
01:36You might remember that we set up a Content type to show where the various
01:39facilities of our Olive Oil Company are.
01:42We can see that by going Home, and looking at our list of employees.
01:47As we scroll down, we see our locations Ventura orchard, Oxnard office, and
01:52Carpinteria orchard.
01:54But all that we have in that Content type right now is the title;
01:57we don't have any actual location information.
01:59I am going to change that now by going up to Structure and Content types, and
02:05then managing the fields of that location Content type.
02:09So actually we do have two fields, Location and Amenities which we added
02:12earlier in the course.
02:13I'm now going to add another one called Address.
02:19When we select our Field type, we have a new option, Location.
02:25It has only the one option for widget.
02:26So I scroll down and Save.
02:29There are quite a lot of settings associated with locations.
02:33This area here for Collection settings lets you decide what parts of the address
02:37you feel that you need for each location.
02:40I am just going to go through this quickly.
02:42We don't really need a Location name, because that's already in the title.
02:46So I will say Do not collect.
02:48We will have a Street location.
02:50We don't really need Additional; Do not collect.
02:54City;
02:54we definitely want.
02:56For State/Province we know that all of our operations are in California, so I
02:59will simply Force a Default of California, and as I start typing, you notice
03:04that the Location Module already has the names of the states in it.
03:08So we just go down and select California.
03:10We'll accept a Postal code and I will Force Default of United States.
03:16I am also not going to collect the Coordinate Chooser.
03:21This allows people to enter actual geographic coordinates.
03:25Scrolling down a little bit further we can hide certain fields from display.
03:29This is actually a good idea in most cases, because otherwise the display
03:33becomes a little too confusing with the coordinates and all of this extra stuff.
03:38I think the only thing I'll hide is the coordinates.
03:41Scroll down further and Save.
03:44We have some additional settings we can make here.
03:47Most of it just repeats what you saw on the previous screen, and Save.
03:52I am also going to move the address above the Amenities, because I think that's
03:57more important to collect early in the process.
03:59Scroll down and Save.
04:01Now I'll quickly add the addresses for my three locations.
04:04To do that, I will go to Content, and filter based on Location.
04:11Then I'll quickly edit them.
04:15Scroll down and Save.
04:20Now Ventura, and finally, our Oxnard office.
04:36So we now have our addresses in properly.
04:39The next step is to let location turn them into coordinates.
04:42For that, we need to set up a Geocoder.
04:45To do that we go up to Configuration and Location.
04:50We don't need to change any of these main settings, and most of them are fairly obscure.
04:54So I will just skip over that.
04:56What we do need is our Map links.
04:59It's a very long list, because it covers so many countries.
05:01I will just do a quick search for United States.
05:07And you see that it already has Google Maps selected.
05:09I will take a quick look at the Terms of Use by opening that window in a new tab.
05:17Naturally, when you sign up for Google Maps, you're going to want to
05:19actually read this.
05:21It does have some specific restrictions.
05:23For example, you can't use this behind a firewall, you can't use it on a certain
05:26kind of commercial site, things like that.
05:28Also, you're limited to the number of accesses that you are allowed to these maps.
05:32So make sure that your case fits in with the rules that go along with Google Maps.
05:36But for now I will just close this.
05:39Before we go on, I want to show you some of the other tabs here.
05:43So I will scroll back up to the top, and click Geocoding Options.
05:48The part that we're interested in is this Google Maps geocoding minimum accuracy.
05:53This pop-up menu lets you determine how little information you'll accept
05:56before you map a place.
05:58Right now, it's set to put a pin on the map even if all you know is the county.
06:01I am going to change that to Street level accuracy, because I want to require us
06:06to have at least that much information.
06:08In our case, since we know all of the addresses we could be even more
06:11accurate, but that's fine.
06:12Now I will search for United States again, scroll down a bit and say that we
06:18want to use Google Maps.
06:21After selecting Google Maps, scroll to the bottom and click Save configuration.
06:27Now when you search for United States again, you'll notice that this has changed
06:32to Configure parameters.
06:33I will open that in a new window.
06:38In order to make this work we need a Google Maps API key.
06:42You can get that by going to the Sign-up page.
06:44I will open that in a new tab.
06:49Once there, you scroll through the screen.
06:52Again, read the terms of service, make sure that you agree to them, and if
06:55you do, check this box.
06:58We then enter in our URL here.
07:00We go back and simply select the top part of the URL, everything before the
07:05slash and paste it in.
07:11Then generate API key.
07:14However, to use the service you must first be logged in to Google.
07:17So I will do that now.
07:25Now scroll down again and repeat the process.
07:29Of course, you could sign in first, and then generate API key, and there it is.
07:36We don't actually need all of this code.
07:39That's what the module itself takes care of.
07:41The part that we need is just this key up here.
07:44So I'll copy it, go back to my site, and paste it in here, and we're done.
07:55We can tell whether it's working by going back and looking at one of our locations.
07:58I will go up to Content and then open up any of the locations.
08:02I'll look at the Ventura office.
08:05As you hover the cursor over this Google Maps link, you see down in the corner
08:08that URL shows that it's searching by the address.
08:11That doesn't mean that we've been geocoded.
08:14One thing that I've found is you have to go back in and refresh it.
08:17So I will edit, change this let's say to 22, and then I'll change it back to 23.
08:22That's why it's a good idea to turn on your Geocoding options before you
08:27add your locations.
08:28Go back in and edit, and change it back to 23.
08:34Now when we save and hover over that link, you see that link down in the corner,
08:39it actually shows the coordinates, 34 points so and so.
08:43That's the latitude and longitude.
08:45That means that our coordinates are working correctly.
08:48What we've done here is an interesting combination of Drupal, information, and a
08:52third-party service;
08:53in this case, from Google.
08:55The information we enter goes out, gets processed, and then comes back enriched
09:00with the latitude and longitude.
09:02That's currently the only way the Geocoding works and it will probably be that
09:05way for a long time;
09:07that is, you won't have the database on your own computer, because a geocoding
09:10database, as I am sure you could imagine, is simply enormous.
09:15It has to store information about nearly every address on earth and be backed by
09:19algorithms that figure out addresses that aren't in its database.
09:22For example, if a house gets built between 24 and 28 Main Street, it has to
09:28assume where 26 Main Street is;
09:30just in-between the two where that new house is.
09:33So when you consider all of the stuff, it's pretty incredible that you gain all
09:37that power for free just by installing the Location module.
Collapse this transcript
Displaying basic maps with the GMap module
00:00We gave addresses to our company's three locations using the Location Module in
00:04a previous video, but right now they're just showing up on our site as text.
00:08You can see that if you click any one of them and there it is.
00:12That's useful if you know your way around the area, but not if you want to see
00:15which one of these locations is closest to you.
00:18For that we need to map those points.
00:22Drupal has several mapping solutions available.
00:24I showed you where to find them at the end of the video understanding locational data.
00:29We're going to use the one that I think is the easiest called GMap.
00:32It basically just takes those addresses and displays them using Google Maps.
00:37That means you'll have to get something called an API key from Google, which we
00:40got in the video Setting Up the Location Module.
00:44Steps in that video are necessary for making the steps in this one work.
00:48So be sure to go through it if you haven't already.
00:51We're going to get the GMap module.
00:53It's at drupal.org/project/gmap.
00:57As usual you scroll down, copy the link location then go back and install it in your site.
01:05Click Modules, install a new module, Paste the URL, click Install and then Enable it.
01:19Scroll down a little bit and you see the new modules under the Location group.
01:31We're going to enable all four, GMap, GMap Location, GMap Macro Builder and
01:36GMap Taxonomy Markers.
01:38Then scroll to the bottom and Save.
01:43The way that you can figure that is you go up to Configuration and then click GMap.
01:57Notice that you're going to need an API key.
01:59I've done this previously but I'll go back and get another one.
02:03I'll open this window in a new tab and then scroll down.
02:09You'll see the terms of service and if you agree with these check this box.
02:14We put our URL in here;
02:15I'll just go back and get that.
02:17Simply twotrees:8082 is fine and Generate API key.
02:27Scroll back up because all that we need is this key part here;
02:31we don't need the stuff with all of the scripts and the tags, and so on.
02:35Copy this, go back to our site and Paste it in.
02:40There are a lot of other options on this page.
02:43We'll ignore them for now, scroll all the way to the bottom and click
02:47Save configuration.
02:48If we're successful we'll see something new on this page, the Default Map Settings.
02:54Now let's talk about the rest of the things done here.
02:57You could change the default width of your map, for example, like that;
03:01change the height a little bit.
03:04Change where the default center is, right now it's at 40 North Latitude and 0 Longitude.
03:11As you move the map around you'll notice that the default center changes, so you
03:15don't actually have to enter the coordinates here manually.
03:20Scroll down further and a lot of these settings have to do with the way the map looks.
03:25Very useful if you want to play around with it but we'll skip over it for now.
03:28Here you can decide whether to make all of the maps available or just some of them.
03:35For example, I'll add the option for people to see the terrain the physical features.
03:41The most important part for us is this Map Behavior Flags area down here.
03:45I'm just going to turn on a couple that I find useful.
03:49One is Auto Zoom that makes Google Maps resize the picture that you see, so it
03:54only shows the area containing the points that you have mapped.
04:00The other thing I want to change is the Marker action.
04:02When someone clicks on a marker I wanted to show a little info window and
04:08that's it, now I'll Save.
04:10Of course if you do start working with the GMap module I'd recommend that you
04:14spent some time going through all of those settings to see what they do.
04:17Now let's go back to our front page.
04:21We have some new options here in this Navigation menu and remember this menu is
04:25what administrator see, so not everybody will see this.
04:28But if I click Node locations it shows me all of the nodes for which I've
04:34entered a location information and there they are.
04:37If we click on any one of these, we get a little bit more information and we can
04:41change what that information shows.
04:43You'll see that later in the course.
04:46We also have User locations but we haven't mapped locations to our users yet.
04:51Users in this case is not the people we've entered as employees, they're users
04:55of this Drupal site.
04:56If we click the People menu we only have one user, the admin and of course
05:00there's no location connected with that person.
05:04So those are the basics for getting a simple map that shows all the nodes that
05:07have a location associated with them.
05:09But as you saw from that earlier Configuration screen the GMap module offers
05:13quite a few settings to change the experience.
05:16Besides that screen there are two others worth noting.
05:19The first one is at Configuration.
05:22Then instead of GMap we go to GMap Location, we'll scroll down a little bit.
05:29We see that it's broken up based on settings.
05:31We're not doing any kind of User Settings.
05:33Once again this is mapping locations connected with users of our Drupal site.
05:37So we'll just skip over that.
05:38We'll get down to the part that matters to us, the Node settings.
05:42The Macro defines what the map will look like when it first shows to people.
05:46I'll skip over that for now and go to Markers Per Content Type.
05:53You might've noticed when we show that map, it had those weird little icons
05:57with the faces on them.
05:58That's the mascot for Drupal known as the DrupalCon and by default that's what
06:02all of the pinheads are.
06:04We're going to change that to something that's a little bit more appropriate for
06:07our olive company, how about some kind of Dark Green.
06:10There we go, Small Dark Green.
06:14You can change this of course Per Content Type.
06:16So if you do have employees mapped out as well as locations you can show them
06:20differently with different colored pins.
06:22For now though, we'll just scroll down and click Save configuration.
06:25Now let's go back to our front screen and we see we have in fact changed that
06:33into those small olive colored locations.
06:35The other configuration screen that you might find useful is this Build a GMap macro.
06:41In the screen we just came off of you saw that little area which showed all of
06:45this code that defines a GMap macro.
06:47You can actually build one visually here by changing where it zooms in.
06:53Now this only matters if you don't have Auto Zoom turned on.
06:56If you do it just overrides what the macro says.
06:59What happens when you click on the map and so forth.
07:08As you do that the Macro text down here changes to reflect all the settings
07:11you've made up here.
07:12You can then copy this Macro text and use it at various places within Drupal.
07:17For example, you could go up to Configuration and back to GMap Location and
07:22paste it into this Macro area.
07:25We're not going to do that because as I say we have Auto Zoom turned on and that
07:28takes care of a lot of these issues.
07:30There is one last thing that I want to point out.
07:33Even though this looks fine to us right now when we go and look at the map and
07:37I'll do that by going over to Node Locations, by default the GMap module limits
07:42who can actually see this map.
07:43You'll see that if I go up and copy this URL and then switch to a browser
07:47where I'm not logged in.
07:50Go in and paste it and we get another Access Denied.
07:55In order to change that you'd go up to People and Permissions then scroll
08:01down to GMap Location.
08:03I'll just do a simple search for it.
08:09You could then allow everybody to view the node map or just those people are
08:12logged in if you want.
08:14We're going to leave this how it is though and close this overlay.
08:18So, we now have a map with all of our points and because we only have three
08:23points the simple map we've created works just fine but if we have a lot
08:27more, or we wanted to select only certain points on the map we'd have to set
08:32it up using a view.
08:33I'll show you how to do that in the video Displaying Custom Maps.
Collapse this transcript
Displaying custom maps
00:00In the video displaying basic maps with the GMap module, you saw how to display
00:05all nodes that have a location on a map and we can see that by clicking Node
00:09locations and there's our map.
00:13But that isn't very flexible.
00:15It's an all or nothing proposition.
00:17Fortunately, we can change what shows up on this map much better by using Views.
00:22This video shows you how.
00:24First we have to go to Views and create a new view.
00:26To do that, go to Structure and Views and then Add new view.
00:31I'm going to call this Fancy map, it'll be all of the content of the type Location;
00:38this is what we set out earlier showing where all of our offices are.
00:42We'll create a page.
00:43And the Display format it's going to be a new type called GMap.
00:47It will be a GMap of fields.
00:49This way we can break out exactly what we want to show in the little bubble that
00:53pops up when we click on one of the locations.
00:55I'm also going to add a menu link so that we can get to this map easily and
00:59Fancy map is just fine, and then I'll Continue & Edit.
01:05If we scroll down to the preview area you'll notice we don't actually see
01:08anything, that's because as it says here GMap views isn't compatible with live
01:13preview, you'll have to see it in the site itself.
01:15So let's will back up, go to our Page and then view the page in a new tab. Ah!
01:21But you see it's not found, and there is a good reason for that.
01:25Even though we've created this view it's not permanent, it's not real until we click Save.
01:30So I do that now and then take a look at that page, and indeed there it is.
01:37Looks very much like the Node locations page did before we made some changes
01:41to it but now because we're working in a view we can change a lot more than we could before.
01:46I'm going to leave this window open so we can see our changes as we go, but
01:50first let's go back to our view.
01:53The first thing I'll do is I'll go down and I'll take a look at the settings
01:56that are available in GMap.
01:57So go to Format and click Settings next to GMap.
02:00You might remember from an earlier video we talked a little bit about Macro and
02:04how you can change what the screen shows by changing the Macro, that is where
02:08the map is focused, how big it is, things like that.
02:11We'll come back to this a little later.
02:14We can change whether we see different markers for different content types or by
02:18taxonomy term and so forth but since we're only using one content type I'll
02:22simply leave it as single marker type.
02:24Scroll down a little further and we see which marker to use.
02:29Let me change it from that little DrupalCon back to our Small Dark Green and it
02:34gets more appropriate for an Olive company, don't you.
02:37The other thing I'll change is this Display a tooltip.
02:39Of course when you're making your own maps you're going to want to go around and
02:43look at all of these options and see which ones work best for you.
02:46Right now, we only have one field in there the Title so that's fine and I'll Apply.
02:52Now if I Save and reload that page w see that indeed we have different marker types.
02:59As I hover over any one of them we see the title.
03:03Let's go back and make a few more changes, but first I want to open up this
03:07Build a GMap macro window.
03:08We'll come back to that in just a minute.
03:12You might remember down here next to Format we could enter a macro to change the appearance.
03:17Let's do that now.
03:18I'll go over to Build a GMap macro, which we just opened and I think I'll just
03:23change the size of that map, it's a little bit small for our site.
03:26So scroll down and look for the Map width and height.
03:32Let's try 600 pixels wide and I think I'll keep the Map height only at 400 pixels.
03:37Then as I scroll down there's my Macro text, I'll copy it, go back to my view
03:44and paste it in here, then I Save.
03:49Save the entire view and take another look at our map.
03:53That did exactly what we wanted.
03:55If you wanted to gain full control over the appearance of this window you'd
03:58have to turn off the Auto Zoom feature that we turned on in the video
04:01Displaying Basic Maps with the GMap Module, but I think its fine so let's leave it as it is.
04:06Now I'm going to finish up by using some other skills that you saw throughout
04:09this course to sweeten this map up.
04:11Right now, when you click on any of these map points, all that you get is a
04:15title and of course if you click there it leads to the node itself.
04:19I want to show more information then that.
04:22We can do that by going back to our View.
04:25Go down and add the fields in this Fields area, so I'll click Add, search for
04:30the address itself and add this Location: Address.
04:36This might be a little confusing because there're two different address fields.
04:40If you have any doubts when something like this comes up try both of them and
04:43see which one works.
04:45There's no penalty for doing so and it only takes a moment.
04:48For us we'll say Add and configure fields.
04:51I think I'll leave it as it is, just to see how it comes out and then Apply.
04:56Go back up and Save and reload our map.
04:59Now let's see what happens when you click on one of these map points.
05:04Indeed, we see the entire address.
05:07We could go back and remove the label and so forth.
05:09There is always a way that you could sweeten this up further but I think this
05:12is fine the way it is.
05:14The last thing I want to do is kind of fancy.
05:16I'm going to use an attachment to show not only the map but also all of the
05:21addresses on the same page.
05:23To do that I'll go back to the View, and then I'll Add an Attachment.
05:27The Format will not be another map instead it'll be a table.
05:32So I'll click GMap.
05:34Make sure that I override otherwise I'll ruin my map as well.
05:37Save that, it's in italics.
05:39So I'll go back and change it to Table and then Apply.
05:43Leave it as it is and Apply.
05:46Let's see how that looks by scrolling down to our preview area.
05:49That looks pretty good.
05:50I'll then go back up to my Attachment Settings and attach it to the Page.
05:55Remember that Page is where we're showing the map itself and Apply and I'll put
06:00afterwards and Apply.
06:04Let's save that and see how it looks. I saved it.
06:07Go to the Map, reload.
06:09Now we have not only the map showing the points but also all of the addresses,
06:14two different ways of showing the same information in a convenient format.
06:18As I say we could go back and pretty this up quite a bit.
06:21For example, we probably don't have to say that it's in the United States.
06:25But there's no need to go into the details of changing these things here because
06:28you've already seen how to do all of them throughout the rest of the course.
06:31Apply those lessons well here and spend some time fiddling with the GMap Macro
06:36settings and you can create some truly amazing user experiences.
Collapse this transcript
8. Putting Data in Other Forms
Exporting data in simple text form
00:00We started this course by seeing how to get information into a data
00:04driven Drupal site.
00:05Then we started getting it out in increasingly complex formats.
00:09Now I would like to take a step back and show you how to get it out in a very
00:13simple format as a plain text file.
00:16That's useful for many reasons.
00:18You could then open it in an Excel spreadsheet or import it into another kind of
00:22web or database system.
00:23I am going to also use this video to showcase a few tricks you've already seen.
00:28If you haven't been following along with this course, don't worry.
00:31I will still show you how to get the data out we are just going to take a couple
00:35of detours along the way to strengthen our knowledge.
00:37We will start by creating a new view.
00:39Go up to Structure and Views and then click Add new view.
00:44We will call this Tabular export and it will be All Content of the Type Employee.
00:52Scrolling down further we will create a page.
00:54It will be an unformatted list of fields and we will create a menu link just so
00:59we can get back to it more quickly.
01:02Tabular export is fine for the link text.
01:04I'll then click Continue & edit.
01:05The first thing that I want to do of course is to save.
01:10That makes the view more permanent.
01:13I want to change the pager before I do anything else though, because I want it
01:16to show everything that's in the database, not just the first ten items.
01:20The way to do that is to change the items to display to 0 as it explains in the
01:25text here, then Apply and once again I Save.
01:31If we scroll down, we can see what that looks like so far.
01:34We only have the employee's IDs which you might remember is the title of the node.
01:39So let's add a few more fields.
01:43First, I'll go in and add and let's add our first and last name.
01:49First name and Family name, and I'll just accept these defaults.
01:56Scroll down to see it, yup so far so good.
02:00I am going to remove that Title field though.
02:02I can simply click it and remove.
02:06Next I'll add the address, which we put them in an earlier video on locations.
02:10We go down and Add the field and add Content:
02:14Address and Add and configure fields and Apply.
02:19Let's see how that looks. Aha!
02:21We don't see any addresses.
02:23You might remember from an earlier video.
02:25That's because the addresses are stored in a different Content Type.
02:28They're stored in the Location Content Type, not the Employee Content Type.
02:32So to make this work we had to go up and add the relationship.
02:36It relates to location.
02:37So I check that and add.
02:40To make things a little cleaner I will change the identifier to location.
02:44That's just an administrative label and I am going to require this relationship.
02:48In other words, if an employee doesn't have a location, they won't show up in the list.
02:52So Require and Apply.
02:54Then if I scroll down I still don't see the address.
02:57That's because I have to go back and change the field showing the address so
03:02that it uses that relationship, and apply.
03:05Now when we scroll down there is our address.
03:09You saw the information about relationships and the video extending views
03:13with relationships.
03:14The problem here is that this address block is just too complex.
03:18Remember, we want to export this is as a simple text file and this block
03:22contains all sorts of extra croft such as the line breaks and this Google Maps
03:26link, we don't really need that.
03:28Fortunately, we can tease out individual bits pretty easily.
03:31I will go back up to my Fields and remove the Address block that we have there now.
03:36Then I will go back in and add some other parts.
03:40If we filter by Location you see that we can add the city and if we scroll
03:45down a little further the Postal Code, the Province which is in our case the
03:49State and the Street.
03:51Add and configure those fields and then for each one we have to require that
03:55relationship just as we did for the whole block.
03:57Now if we scroll down we see that it's much more atomic.
04:04We will be able to export a much better text file this way.
04:08I'll rearrange these so they are in the proper order by going up to Fields and
04:11rearrange and let's have the Street, then the City, then the Province, then the
04:18Postal Code, and I will put the Family name after the First name and Apply.
04:21So now we have all the data in one place and of course we could continue to add more.
04:27The next step is to put it into the format that we need, because this isn't a
04:31very good text file.
04:32We could use it, but we can do better.
04:34There are several ways to do that.
04:36You could hide all the fields except for the last one, then rewrite that field
04:40using the technique you saw in the video rewriting field output for
04:43interesting results.
04:45But here's an easier way.
04:46We're going to put all of the fields into a table, all in one column, the way I
04:52do that is go up here and first I'll Save for safety, then change from an
04:57Unformatted List to a Table.
05:00Then I'll put them all into the same column.
05:02Let's put them into that First name column.
05:10We can separate them by putting a Separator up here to show how it works.
05:14I am going to just put XXX and Apply.
05:18Now we will Save for safety and scroll down and see what it looks like.
05:23This actually could work.
05:25We could copy this and paste it into a text file like so and then do a search
05:31for that XXX and replace it with whatever delimiter we want.
05:34The reason we weren't able to put a tab character directly into Drupal is
05:39because if you go up here and change the settings, you can't enter a tab here.
05:43If you hit Tab it just goes on to the next field.
05:46You could of course also do Separators like quote comma quote and things like that.
05:51The important thing is that you make a Separator that doesn't show up in the text itself.
05:56Then when you simply copy and paste the text you can do a search and replace
06:01and change it however you want into tabs, for example, and then move it into an Excel spreadsheet.
06:07But for now I'm going to leave it the way that it is.
06:11I should mention that there are other ways to get information out of your
06:14data driven Drupal site.
06:16If it's going from one Drupal site to another, you could combine views in the
06:19sending site and feeds in the receiving site quite well.
06:23You saw how to use feeds in the video importing data using feeds.
06:27There is also a whole group of modules for this very purpose.
06:32You see it by going to drupal.org/ projects/modules, filter by Compatibility so
06:38you only see those modules that fit your version of Drupal, in our case that's 7
06:43and then select Import/Export from the Module categories, and Search.
06:48The thing with these modules is that you're often at the mercy of their
06:51creator's ideas about data migration.
06:54Sometimes those ideas expand your abilities tremendously though.
06:57I found that for most simple exports though a quick view does the trick best.
Collapse this transcript
Adding dates and calendars
00:00Date based information is notoriously difficult to work with.
00:04You might have an event that starts in the evening and finishes the next morning
00:07so that encompasses two dates, for example.
00:10Then there are leap years to take care of and the differing numbers of days in the month.
00:15Fortunately, there are a few modules for Drupal that take care of all those
00:18complexities for you and put your date based information into a calendar.
00:22To get started we will need two modules.
00:25The first one is called Date and it's available at drupal.org/project/date.
00:30We scroll down and install this module in the usual way.
00:33I should mention that this module is under very active development.
00:37There are some known bugs at the time that I'm recording this.
00:40So I am going to use the Development releases.
00:42You of course should use the latest stable release.
00:45I will copy this link location, then go back and install it in the usual way.
00:51Click Modules>Install, paste the URL, and click Install.
00:59Now I am going to go onto the other module that we're going to use called Calendar.
01:02It's a drupal.org/project/calendar.
01:07Once again I'm going to take the development version and install it.
01:13I go back to my administration pages, Modules>Install, and as usual paste
01:21the URL and install.
01:23Now we will enable our new modules.
01:25Click Enable and scroll down to the Date group.
01:31There is it, Date/Time.
01:32We're going to use Calendar, and then we will also enable several of the Date
01:37modules, Date, Date API, scroll down a little further,the Repeats, Date tools
01:44which is very important to what we'll be doing and Date Views.
01:48Scroll all the way down and Save.
01:51We get a few warnings up here.
01:53I will go up and check them out by opening up new windows.
01:56The first is that we have to set the site time zone in first day of week settings.
02:00So I'll open that up in a new tab.
02:01They look okay to me.
02:04So all we have to do is a say Save configuration and then take a look at the
02:08other one, the date format settings.
02:10I will open that up, it also looks fine.
02:14You can incidentally set your own formats as well, but for now I am just going
02:18to accept the ones that we have, and close that window.
02:22Technically speaking, you can now add date fields to any Content Type you like
02:27and build a calendar off of that.
02:28If you go to Structure and Content Types, now let's just manage the Fields and Employee.
02:34You see down here under Add new field we now have a Field type called Date.
02:39However, I found it extremely difficult to create calendars based on such date fields.
02:45Fortunately there is another way, it's called Date tools and it comes with
02:49the Calendar module.
02:51Let me go up to Structure and Date tools and then go to Date Wizard.
02:57Now we can create a Content Type along with a view which shows a calendar all at the same time.
03:02I am going to call this, events.
03:03This is the machine readable name.
03:05So it has to be all in lowercase.
03:07The label will also be Events and for description it'll be Events at our orchards.
03:17This wizard creates a Date fields and I will just leave it as date.
03:22The widget will be a select list and we do want to show repeating date options
03:27for reasons you'll see in a minute.
03:29It'll create a calendar, and let's look at the advanced options.
03:32Do we want an end date to this event?
03:35We will leave it as it is.
03:36We can add an end date, but it's not required.
03:39Finally, we will scroll down and click Save.
03:42Because we have a permission module installed we have to rebuild our permissions.
03:46You might not have to do this depending on which modules you have installed,
03:50but since we installed this module earlier in the course, we just go ahead and do as it says.
03:54Now let's create an event.
03:56To do that as usual we go to Add content and then add an Event.
04:02Right now, all that we have is the Title and the Date.
04:05Our Title will be Afternoon orchard tour.
04:11The Date will start let's say on November 2, that's this coming Wednesday and it
04:19will start at 2 o'clock.
04:21In our case 14 o'clock since we're using a 24-hour calendar.
04:25This will depend on how your computer's time settings are set up.
04:29We want to have this repeat every week and it will continue on let's say until
04:34the beginning of next year.
04:38However, we want this to be not only every week, but every Wednesday and Saturday.
04:43So we will go down Advanced and say Every Wednesday and Saturday.
04:46There is a common mistake here, by the way, which is if you come down here
04:50and just they Advanced Every Wednesday and Saturday and don't say Every Week,
04:54then it won't work.
04:55But we've done everything right.
04:56So let's go down and add a description.
05:01Scroll down and Save. Good!
05:05Now we have an event and we can see all of the repeats that it has.
05:09By the way, you can change how this shows by going up and editing the Content Type.
05:13I click Structure>Content types>Events and manage display.
05:19You will notice this date has a little widget here.
05:22I am going to change it so that we see the repeat rule, but we only see one value.
05:27This will only show us the one that's coming up.
05:29Update, scroll down, and Save.
05:31Now if we go back to that node, we click Content, show all of our content, and
05:39look at the orchards tour, we only see the one that's coming up, but we see
05:43that it also repeats.
05:45That's very useful.
05:45It's much more friendly than seeing all those dates.
05:48That's great, but it's not as friendly as a calendar.
05:51Well, we have that, because we used that Date tools wizard.
05:54To see it go up to Structure and Views, and there is our calendar of events.
06:01Let's take a look at it by opening up this monthly view.
06:04I am going to open that up in a new tab.
06:08We look and you'll remember the first one is in November.
06:11So click Next and there it is, our tour is on Wednesdays and Saturdays
06:17continuing on until January, and then it stops.
06:23The important thing to know is this is an ordinary view.
06:26If we go back to our views and edit it, by going back and clicking next to
06:30Cal_events, we can change all sorts of things in this and in fact I am going to
06:35change the title from Cal_events to something a little more friendly, Calendar
06:39of events, and Save.
06:42You will also notice that it sets up different displays for the Month, the Week,
06:48the Day, and also the Year.
06:50If we save this we can see how that works by going back to that on the page.
06:54Close out this window and go back to our calendar and reload.
06:59They show up in these tabs right here, very handy.
07:03And of course if we click on any of these, we get the node itself, more information.
07:10Something to watch out for though is that view that we were looking, click
07:13Structure>Views and calendar of events.
07:18Even though you can change some things it's extremely complex.
07:22I've had a lot of problems when I start editing things here and there,
07:25especially in the contextual filters and the Sort Criteria and the Filter here
07:29and I find suddenly my calendar simply doesn't work.
07:32There are resources for you to troubleshoot your calendar however.
07:36If we go back to the calendar project page;
07:38again that's at drupal.org/project/ calendar, there is a link here for debugging
07:43information down near the Downloads.
07:45There is also quite a bit more information above this about all of the different
07:48versions it's been through, but click on the debugging information and you get
07:53some tips for helping your calendar to work if you're having any problems.
07:58I think it agree that calendars are the way to look at date based
08:01information, right?
08:02And the great thing is the Calendar module sets it all up for you, the month,
08:06the week, and day views are just right there by default.
08:09The downside is that it's kind of tough to customize these calendars, for
08:13example, to show only four days instead of one day or a week.
08:17But those frankly are edge cases.
08:20Most of the customization you'd want to do is in the calendar's appearance which
08:23will be done through Drupal theming;
08:25not by altering the view.
08:27For information about that, see lynda.com's videos on Drupal theming.
Collapse this transcript
Displaying content in a slideshow
00:00When we created our employee directory, we included photos of our employees and
00:04then put those photos in a table as you see here.
00:07But you can do much more with photos.
00:09I'm going to show you a neat way to display them that coincidentally also works
00:13on any content, including text content.
00:15I'll also point you to alternative ways to display content because there are a
00:19lot of them available for Drupal.
00:22The one we're going to use is called Views Slideshow.
00:24We get it at drupal.org/project/views_slideshow.
00:31Now I have to warn you before we start.
00:33This module has terrible documentation.
00:36We're going to run into several places where we're going to have to figure out
00:39exactly how it works.
00:41But don't worry, we will work our way through it.
00:43Unfortunately, some modules are like this and you just have to work through them.
00:48But let's get going.
00:49We scroll down and we install it the usual way.
00:53Copy the .gz file's location, go to our site, click Modules, and Install.
01:02If we go to enable this module, we see way down in the Views group that one part
01:08of it, Views Slideshow:
01:09Cycle needs to have another module, Libraries.
01:13This is one example of not-very-good documentation since it didn't actually say
01:17that on the Views Slideshow page, but that's okay.
01:19We'll go up to Libraries and get that.
01:22That's at drupal.org/projects/libraries.
01:27Scroll down and install it.
01:39Now we can enable our modules.
01:43Scroll all the way down to that Views group again and you see we can turn on
01:46both parts of the Slideshow module, and Save configuration.
01:50When we do this, it'll automatically ask to turn on the Libraries module, and we
01:54of course do want that.
01:56The next step is to create a view.
01:59We do that as usual by going up to Structure and Views and then Add new view.
02:05I'm going to call this Employee slideshow.
02:09It'll show content of the type Employee, it'll have a page, and the Display
02:15format will be Slideshow.
02:17However, there's a bug in this module as I record this video.
02:20So I'm simply going to make it Table, and then I'll switch it later on to Slideshow.
02:25I hope that when you see this video, that bug won't be there, but this is one way around it.
02:29I'll then click Continue & edit.
02:31And then I'll save it.
02:33From here I can change it to Slideshow.
02:36I click on Table, Slideshow, and Apply.
02:39That brings us to the options for Slideshow.
02:42And as we scroll through them, ah we see that we actually have to
02:46install something else.
02:47Okay, well, I'll go to that link and I'll install it.
02:50Click the link and it says Download the Cycle Plugin.
02:54Incidentally, this page also shows some really neat examples of all of
02:57the different effects.
02:59So I'm going to leave this window open.
03:02I'll click so that this opens in a new tab, and I want the Full version, not the Lite version.
03:09And there is the file.
03:10Now you'll notice it didn't actually download, it just put this text file up on the screen.
03:15That's okay;
03:16we can actually copy and paste this into our own text file.
03:19So I'll select it all and copy it and then launch a text editor.
03:23I like the Notepad on Windows.
03:25Paste it, and then I'll save this to my Desktop as let's just say cycle.js for
03:31JavaScript, and close that window.
03:37Now let's go back to our settings in our site.
03:40I'll close this window and then take another look at the settings. Aha!
03:46It says that we still need that.
03:48That's because we didn't put it in the right place.
03:51But what is the right place?
03:52Well, let's go back to the Views Slideshow project page and see if it has some
03:57documentation that'll tell us.
03:58Indeed there's a Read documentation, so I'll click that link.
04:03Scroll down a little bit, we're using the most recent version.
04:06I don't see anything here that tells how to install it. But let's see.
04:09Aha! How to install it.
04:12Finally, we find out.
04:14Scroll through here, Install the Modules, we did all of this stuff, Create a New
04:20View we did that, and there's the error we had and now we have instructions on
04:26how to actually install the library.
04:28It has to be inside of a folder called libraries inside site/all.
04:32Well, I know we have a sites/all so I'll create a folder called libraries there.
04:37Open up my installation of Drupal, go to sites/all, and create that folder libraries.
04:48Okay, let's go back to our instructions.
04:52Then create another folder called jquery.cycle. Okay.
04:56Back in, libraries, new folder, jquery.cycle.
05:03And then paste, that's what we have to name this library.
05:08So I'll go back to my Desktop, change my name here, and finally, I can put
05:13it into that folder.
05:17
05:18Now let's go back to our site and see how we're doing.
05:22I click Settings next to Format, scroll down, hurray the warning disappeared!
05:28The only, the other things I have to change in here are to add a Pager,
05:32Controls, and a Slide Counter.
05:35You'll see why in a minute.
05:37I click Apply, now we're finally ready to go. I click Save.
05:40I'm going to add the fields that I want.
05:44Right now, we only have the title and if we look down at this preview, we see
05:48that I actually can move from one to the other.
05:50If I click Next, see it's going from one title to the next.
05:54So it is actually working here.
05:56But we wanted to show photos.
05:58So let's add our Employee photo, configure the fields.
06:05Remember, we don't want them all to be different sizes, so we'll standardize as
06:09the medium size and we'll link it to the node.
06:11So if anybody clicks on one of those pictures, it goes to the node that it's about.
06:16Click Apply, I'll remove the title, and finally, I'll add the person's first name.
06:23Click add, search for a name First name, and remove the label, and Apply.
06:35Let's see how that looks.
06:36Ah, there is one problem here.
06:39You see not everybody has a photo.
06:42So I'll add one more filter criterion by clicking add next to FILTER CRITERIA,
06:47look for photo, we're looking for the file id, and Add.
06:53What we're doing is we're only going to include those photos that have a file id.
06:57That is that have a file attached to them.
07:00And we'll look for those that are not empty, and Apply.
07:04Now let's see, yep, there it is.
07:06There's Tom, so we go the next one, there's Sonya, there's Laura, and so forth.
07:14Let's save that and take a look at our page.
07:18I click Page and view page.
07:21And indeed there it is.
07:23So that's one way to strut your data in an interesting way online.
07:27But there are many others available for Drupal.
07:30To find them, go to drupal.org/projects/modules.
07:36As usual, you filter by compatibility, we're using Drupal 7 and the category is
07:41Content Display, and Search, wow over 300 of them.
07:47As we scroll through the screen, you'll see that most of them aren't really relevant.
07:51Well, there's Views Slideshow which I just showed you.
07:54Scroll down even further, and we get to jCarousel, yet another kind of slideshow
07:59that you can have for your content.
08:01Really, I could do an entire course on all the different slideshow, gallery, and
08:05other eye-catching effects available for displaying your data.
08:09But you don't need me to do that.
08:10Just start exploring and have fun with them.
Collapse this transcript
Conclusion
Next steps
00:00Thanks for watching Drupal 7 Reporting and Visualizing Data.
00:04I hope this course gives you everything you need to build your data-driven
00:07site the way you want it and that it gives you some ideas for creative ways to go further.
00:12If you're still hungry for more information, here are some resources.
00:17The first thing to do is to get an account on drupal.org.
00:22To do that, simply go to drupal.org and click here where it says Log in and Register.
00:28Then click Create new account.
00:30Once you've done that, you can take part in discussions, join special interest
00:33groups, and become part of the larger Drupal community.
00:37On that note, one group you might want to join is the Data Visualization group.
00:42It's at groups.drupal.org/taxonomy/term/7772.
00:50You'll also want to look through the other data visualization modules on drupal.org.
00:54You find them by going to drupal.org/ projects/modules, filtering by your
01:00Drupal compatibility;
01:01in our case, we're using Drupal 7, and then look for Content Display.
01:08There's a lot there which leads us to the last step.
01:12Have fun with them.
01:14Whatever you do next, I can't wait to see the great things you'll do with your
01:17data-driven Drupal site.
Collapse this transcript


Suggested courses to watch next:

Drupal 7 Essential Training (7h 23m)
Tom Geller

Drupal 7 New Features (2h 38m)
Tom Geller



Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 104,069 instructional videos.

get started learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 2,025 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.

preview image of new course page

Try our new course pages

Explore our redesigned course pages, and tell us about your experience.

If you want to switch back to the old view, change your site preferences from the my account menu.

Try the new pages No, thanks

site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

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.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

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

   
submit Lightbox submit clicked