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