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

Varying layout with the Panels module

From: Drupal 7 Advanced Training

Video: Varying layout with the Panels module

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.

Varying layout with the Panels module

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.

Show transcript

This video is part of

Image for Drupal 7 Advanced Training
Drupal 7 Advanced Training

72 video lessons · 10880 viewers

Tom Geller
Author

 
Expand all | Collapse all
  1. 4m 51s
    1. Welcome
      1m 7s
    2. Planning your Drupal career
      3m 44s
  2. 25m 46s
    1. Comparing development and production environments
      6m 22s
    2. Configuring your settings.php file
      7m 10s
    3. Running multiple sites from one Drupal installation
      7m 32s
    4. Troubleshooting common issues
      4m 42s
  3. 51m 20s
    1. Understanding your Drupal site's place on the web
      2m 44s
    2. Selecting a web host
      7m 20s
    3. Using Unix's command-line interface
      8m 23s
    4. Working with your web host's access restrictions
      4m 51s
    5. Using cPanel and other graphical web host interfaces
      3m 40s
    6. Transferring files to and from your web host
      5m 49s
    7. Moving databases using phpMyAdmin
      6m 34s
    8. Moving databases using Unix commands
      6m 8s
    9. Modifying server configuration files
      5m 51s
  4. 27m 10s
    1. Learning from case studies
      3m 13s
    2. Planning your site
      4m 18s
    3. Populating your site with Devel Generate
      3m 42s
    4. Managing URL paths
      3m 20s
    5. Restricting access to downloadable files
      5m 55s
    6. Reusing site components with the Features module
      6m 42s
  5. 21m 53s
    1. Understanding and installing Drush
      5m 23s
    2. Installing Drupal using Drush
      7m 24s
    3. Building a site using Drush
      9m 6s
  6. 31m 59s
    1. Backing up with the Backup and Migrate module
      8m 17s
    2. Moderating comment spam
      6m 47s
    3. Migrating from Drupal 6
      4m 28s
    4. Migrating to Drupal 7
      12m 27s
  7. 22m 24s
    1. Letting users log in through OpenID
      5m 10s
    2. Letting users log in through Facebook, Twitter, and other services
      9m 43s
    3. Republishing posts on Facebook and Twitter
      7m 31s
  8. 1h 5m
    1. Understanding Drupal's base themes
      5m 55s
    2. Introducing base themes: Zen and subtheming
      11m 35s
    3. Introducing base themes: Fusion and extensibility
      10m 44s
    4. Introducing base themes: AdaptiveTheme and responsive design
      7m 25s
    5. Introducing base themes: Omega and mobile devices
      7m 9s
    6. Using Firebug and other theming tools
      7m 20s
    7. Modifying themes with Sweaver
      6m 59s
    8. Modifying themes with Livethemer
      8m 45s
  9. 49m 35s
    1. Understanding the Rules module
      6m 48s
    2. Demonstrating how Rules works in Drupal Commerce
      3m 53s
    3. Creating practical rules
      6m 37s
    4. Improving rules
      9m 10s
    5. Defining conditions with the Context module
      7m 51s
    6. Varying layout with the Context and Delta modules
      5m 0s
    7. Varying layout with the Panels module
      10m 16s
  10. 52m 46s
    1. Enabling social features
      9m 46s
    2. Implementing a voting system
      9m 15s
    3. Rewarding good behavior with the Userpoints module
      5m 57s
    4. Setting up Organic Groups
      6m 28s
    5. Adding content to groups
      2m 21s
    6. Seeing group activity better with views and panels
      10m 13s
    7. Making groups private
      4m 54s
    8. Letting each group have its own permissions
      3m 52s
  11. 25m 32s
    1. Understanding packaged Drupal distributions
      2m 8s
    2. Getting a head start with Acquia Drupal
      7m 28s
    3. Creating online storefronts with Drupal Commerce
      6m 53s
    4. Creating government web sites with OpenPublic
      9m 3s
  12. 1h 30m
    1. Taking the assignment
      3m 26s
    2. Planning the project
      3m 43s
    3. Preparing the infrastructure
      8m 42s
    4. Starting the design
      7m 35s
    5. Filling in the content
      7m 29s
    6. Developing the layout
      10m 27s
    7. Finishing the layout
      7m 8s
    8. Refining the CSS
      6m 32s
    9. Setting up sections for regional offices
      4m 53s
    10. Configuring regional offices
      7m 18s
    11. Connecting to social media
      5m 9s
    12. Cleaning up
      12m 32s
    13. Securing the site
      5m 56s
  13. 37s
    1. Next steps
      37s

Start learning today

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

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

What are exercise files?

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

Can I take this course without the exercise files?

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

Become a member Download sample files See plans and pricing

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

Exercise files video

How to use exercise files.

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


Exercise files

Exercise files video

How to use exercise files.

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

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

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

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


Mark all as unwatched Cancel

Congratulations

You have completed Drupal 7 Advanced Training.

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


OK
Become a member to add this course to a playlist

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

Get started

Already a member?

Become a member to like this course.

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

Get started

Already a member?

Exercise files

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

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

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

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

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

Continue to classic layout Stay on new layout
Exercise files

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

Mark videos as unwatched

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

Control your viewing experience

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

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


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

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

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

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

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

   
submit Lightbox submit clicked
Terms and conditions of use

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