Viewers: in countries Watching now:
This course teaches web site designers how to take their sites to the next level with a few advanced techniques and the free and open-source Drupal software. Author Tom Geller shows how to configure the most popular add-on modules; use *nix commands and an FTP program to manage a Drupal site on a web server; change its visual appearance using the latest graphical tools; automate and speed through common tasks with Drush; integrate with social media sites; and see how "supermodules" like Panels, Context, Rules, and Features open up new worlds of code-free development.
Drupal 7 Advanced Training was designed as a follow-up to Drupal 7 Essential Training and it also dovetails nicely with our other Drupal courses, such as Drupal 7 Reporting and Visualizing Data and Create Your First Online Store with Drupal Commerce.
One of Drupal's stumbling blocks in the design community has been its rigid block and region based layout system. If you want three columns of text in the main content area, you have to make that change using some fancy hand-coding, probably with HTML tables, or CSS. If you want one of those columns to contain dynamic content, then you're off into PHP programming land. To the rescue comes the Panels module, written by the same prolific programmer who created Views, and Chaos tools; his name is Earl Miles. By the way, Panels requires Chaos tools, which we installed earlier in this course.
If you haven't done so, then of course, you should do so before using Panels. You will find it at drupal.org/project/ctools. You get Panels from drupal.org/project/panels. Scroll all the way down, and install it in the usual way. Incidentally, we will be turning on another module in this Chaos Tools suite group a little bit later. The two that we'll enable are simply Panels, which is the main part of the Panels engine, and Panel nodes.
Mini panels is similar to Panel nodes, but whereas Panel nodes works very much like Nodes, as you'd imagine, Mini panels works a little bit more like Blocks, and we are not going to go into that in this video. The Panels In-Place Editor allows you to make certain changes by clicking on content, and once again, we're going to keep it fairly simple this time around. Scroll to the bottom, and click Save configuration. Now I'll create a panel by going up to Add content, and Panel. It acts just like any other kind of node.
The big difference is that that node can be split up into columns and rows. I will accept a Flexible layout, and the title will be Panelized node. I don't need to make any other changes, so I'll save that. Now, that panel doesn't look like anything special, but that's because we haven't set up that layout; we haven't added any content to it. All that we have is that title, Panelized node, and the idea that it's a container for other content. To actually add stuff, we go to the Panel content tab.
Once there, we could start making a layout. I am going to make this three columns. First, I show the layout designer, and then I start adding columns. I will add a region to the right, call this Center, and save, and then add one more column off to the right, and I will call this Right. As you can see, I'm skipping over a lot of options, because the Panels module is so deep. I could then adjust these by simply dragging this right here.
For example, I will make this 50% or thereabouts, and then these I will make about 25%. Yup; it did that automatically. Once I have set up those regions, I can now actually put content in them. So I hide the layout designer. You will notice that I actually created two different areas called Center. Now, I could go back and change those, but quite honestly, it doesn't matter much. I think I will though. I'll just go in and change this by changing the Region settings, and I will call it Left, and save.
Now we will hide the layout designer, and start adding our content. I will put some custom content over here to the left, scroll down, and Finish. As you can see, it's just like adding an ordinary node. The fun thing about Panels is that you can also add dynamic content. I will show you that by adding something to the center, and to the right, which is dynamic. I'll use the Activity group, and say Recent comments, and Finish.
Over here, I will make it recent users; who's logged in, that is to say. Finally, we save that, and let's take a look at what that looks like. Click View, and there it is! We now have our three column layout. That's the basic operation for Panels, as it applies to nodes. As I mentioned before, you can also create panelized blocks by turning on the Mini Panels module that we kept disabled. There is one other trick that I want to show you.
We can actually use Panels to change the entire page, and in fact, to override certain pages that are in the system. To start out with that, we go up to Modules, then down to Ctools, or Chaos Tools. What we want is the Page manager; turn that on, and save. Those pages appear under Structure, and Pages. Now, I know the names can be a little confusing, because Pages is so similar to Basic pages.
A page is something that's created by Chaos tools, and Panels. As you can see, you can add custom pages, and again, have those react to whatever criteria you like, or, just as in Views, you can use the ones that come with the program in order to override existing ones. The one that I like to use is the node_view one, so I am going to enable that, and then simply close out this overlay. I just want to show that that doesn't actually change anything until we start to edit it. So let's go back to Structure, and Pages, and Edit it.
The first thing we do is add a new variant. You can have as many variants as you like, and each variant reacts to different criteria. We are only going to add one though. The title will be Graphic on the right. It will be a Panel. The other kind, HTTP response code, is very rarely used. We will have certain selection rules. In other words, it's going to react only when the article nodes are showing, not when all nodes are showing. And then Create variant. Here, we have come to that use of the word context that, as I said before, is a little confusing.
This isn't related to the Context module. In other words, it's asking, what are the criterial in which this variant should show? In our case, we want it to be when the Node type is an Article, and Save. Then we click Continue. Once again, we can choose how we want that page to be set up. We could, for example, have very simple one, two, or three column layouts, or as I like to usually do, I simply do Flexible, and then I can change it however I want. Then click Continue.
Then you have quite a lot of options having to do with CSS; applying it to different parts of the panel, and so on. We are going to ignore that, and say Continue. Finally, we arrive at a similar sort of layout designer. I will click Show layout designer, and in fact, I'll add a column off to the right, and Save. Now I will hide the layout designer, and actually add the content to those parts. I am going to keep it very simple for now.
I'll make this side the body, and the stuff on the right the graphic. We want Node, and Node Body over here, and then we have some options. Then over here, Add content, and it will be Node > Field: Image, and Continue. Once again, you can add all sorts of things to these regions, including views, activity blocks, and so on. For images, we have a few different options. I am going to just put in the thumbnail size there.
Although, of course, you could put in whatever you want. I will link the image to nothing in particular, and then say Finish. Now that we have done that, we create the variant. Once you've finished all of that, it's very easy to make a mistake here, and simply close out the overlay, because you said, okay, continue on, and save, so that you either have to click Save, or Update and save here. Now let's close out this overlay, and see if it did what we expected. And indeed, it did.
It redrew the page with the body on the left, and the image on the right in the thumbnail view. Now you'll notice that this doesn't contain all of the information that we used to have here, and we still have this body and image title here, and of course, we could continue adding taxonomy terms, a comment form, comments, and all of that sort of thing. But as with the Views, Context, and Rules modules, this super module really has a lot of ins and outs. You can spend a lot of time doing this, and I simply recommend that you go ahead and play around as much as you can.
You'll learn that you can remove these headlines, and so forth. Now, before we finish, I want to remind you of something we did in a previous video about defining conditions with the Context module. We defined some articles as premium, and set up a context to prevent anonymous users from seeing them. So here's the question: does that context still work? We are looking here at a node which, you might remember, does have that tag, and we can see that by editing it. There is the Premium tag. Let's switch over to a browser that's not logged in, and see how that looks.
We will go down, and click on that node right there. And indeed, the context overrides that panel display. In this case, you might remember, the context we set up was set to be triggered based on the path, and that hasn't changed in this case. But you do have to be careful about this sort of thing if you've hidden any kind of content. If you are a little careless, you could permit panels to expose all of that stuff. The last thing I want to do to clean up is to take this Panelized node off of our front page.
That's easy enough to do. Simply edit it, and treat it just like any other node; take off Promoted to front page. Of all the videos I've done for lynda.com, this one is probably the shallowest when compared to how deep the Panels module is. I think you can see just from the enormous range of options on the screens we clicked through, just how deep it is, and as with the Views module, you need to spend some time with it. We will see a little more of its functionality later on in the course when we use Panels to expose things in organic groups.
You will see that in the video, Seeing Group Activity Better with Views and Panels.
There are currently no FAQs about Drupal 7 Advanced Training.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.