Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

Setting up a Multi-column Home Page

0 (0 Likes / 0 Dislikes)
Hello everyone, and welcome to Drupal and Panels. Today I get to share with you my favourite module in all of Drupal, and that's the Panels module. But before I start to show you all the great things you can do with Panels, I'd like to explain a little bit why the Panels module is necessary. The Panels module allows you to define custom layouts and displays of content for your site. The way this problem has traditionally been solved in Drupal is by allowing you to define specific regions in your theme and then allowing you to add different blocks into those regions. On this site, you can I'm using the Bartik theme, and if I want to know what regions are available to this Bartik theme I can do that from the 'Blocks administration' page. This is under 'Structure'; 'Blocks', and at the top of this page there's a link which says 'Demonstrate block regions'. If we click on that link, we can see the regions that are available to the Bartik theme. From looking at this page you can tell there are a lot of regions, and there's a good reason for that. This systems assumes you want the same layout for every page on your Drupal site. As it turns out, most websites don't want the same layout on every page, and the only that you can get this system to allow you to have different layouts for different pages is by defining regions in your theme that are either used or not used, based on page. I find that to be a fairly sloppy solution, and what I like to do instead is use the Panels module. Let's say for example, a designer came to us and said she wanted us to use a custom two-column layout for the homepage of our website. We want a new article on the left-hand side, and we want a giant advertisement on the right-hand side. If we look at this layout, and we compare it to the regions that are available to the Bartik theme it doesn't look like there's a very easy way to get that content to display. It turns out there is an easy way, and all you need to do is use the Panels module. So I'm going to go to the 'Modules' page, I'm going to turn on Panels and two additional modules. The two other modules I'm going to turn on are both in the 'Chaos Tools Suite'. One of them is 'C-Tools module'; this is the module Panels depends on; and the other one is the 'Page Manager' module. So I'm going to turn C-Tools, Page Manager and of the course the Panels module itself. Then click 'Save'. Once these modules are turned on you'll notice that there will be a new link under your 'Structure' section of you menu, called 'Panels'. We're going to visit that page and we're going to use the Wizard to walk us through building our first panel. On the left-hand side where it says 'Create new...' we're going to click the link for Panel page and walk through creating a new custom layout for our homepage. The first things we're going to define are the Administrative title, we're going to call it 'Front page'. And then Administrative description, also Front page. And then a path for our page. You'll also notice there's a check box right here, that allows us to make this your site homepage; that's exactly what we want to do so we're going to ahead and check this box, and click 'Continue' at the bottom of the page. The second step of our Wizard has us choose the layout for our new page. So, since our designer said we need to do a two-column layout, we're going to change the Category to 'Columns 2' and look at the two-column layouts that are provided for us by Panels. The one we want is this one on the left; just a very simple left-right column layout. We're going to click 'Continue'. The third option is our settings for this panel. On this page the only thing that's of interest to us right now is this 'Disable Drupal blocks and regions' checkbox. And what this will do is prevent the content in our left sidebar from appearing on our homepage. We're going to go ahead and click 'Continue', bottom of this page, and now you'll see a wireframe layout of what our content will look like. We've got a grey box indicating the left, a grey box indicating the right, and a little area at the top where we can define the title. As it turns out I don't want a title for my homepage, so I'm going to change the Title settings to 'No title'. And now you'll see that the text box for the title has disappeared. We're going to go ahead and add some content to the page here. On the left-hand side we add content by clicking the cogwheel at the top-left of the left-hand side region. And the first option in that dropdown is 'Add content'. So we'll choose to add content, and when the 'Add content' screen opens, you'll see a bunch of catagories on the left-hand side. What you see here, by default, are all of the blocks that are available to you via the blocks interface. Also re-organised and available to you in the Panels interface. So everything that you should normally have access to, you can reach through Panels. We're going to go ahead and add a block that we've already created; this block is an ad. So under 'Custom blocks' we'll find one here called 'Ad', and we'll drop it into the page. It gives you some configuration options about how you want your ad to display. In this case, it's just asking us if we'd like to over-write the title or if using the title 'Advertisement' is correct. We're going to leave it as 'Advertisement' and click 'Finish', and it'll drop that content into our wireframe on the page. We're going to do the same thing on the right-hand side, but instead of adding an ad, which was a block, we're going to add an existing piece of content. So we're going to choose the 'Add content' link in the dropdown, but in the overlay that opens up, there's another type of content linking at the bottom called 'Existing node'. So we're going to click on the link for 'Existing node' and now it will let us enter in the title or 'Node ID' of the piece of content. So if we happen to know the title of the piece of content though there's a nice little auto-complete here that will help us find it. And after we've added the piece of content, we can also decide how we would like it to display. The most important configuration on this page is this 'Build mode' down at the bottom where it says would you like to see a teaser? We could also change this to be the 'Full content'; in this case I think a teaser makes sense, and since we've left the Build mode here to be 'Teaser' we can also leave this box checked, which will include links for 'add comment' or 'read more'. If we decided to show the whole piece of content on the front page, it might not make sense to leave links here to read more. We're also going to check this box to 'Link the node title to the node', and that will allow the title of the piece of content shown on the page to link to the rest of the piece of content. We're going to go ahead and click 'Finish' and that content will be dropped in to the right-hand side of the page. The best part about Panels is its drag-and-drop ability. We can click on any piece of content, and drag it in to any region on the page. This makes a lot more sense for anyone who's used to dragging and dropping layout builder tools. So now we've got our content on the left and our ad on the right just like our designer asked. Now we can go ahead and click the 'Finish' button, and on the next page you'll see your Panel in the Page Manager interface. For the most part, we're going to come back and visit a lot of these options later; for now all you need to remember to do when you get to this interface is to click 'Save' and there's two ways to do it. There's an 'Update and save' button in the middle of page, and there's also a 'Save' button at the bottom-left. As long as you click the 'Save' button your work is complete, and you can go back to the homepage of you site and check out your new two-column layout. This is really great, but using the Page Manager interface can be overwhelming. Using the Panels Wizards can be overwhelming to some new users. And sometimes you just want to let them to edit the content right on the page. As it turns out, there's a module for that so if we go back to the 'Modules' page, Panels provides a module called the 'In-Place Editor'. It's in the same group as the Panels module. And we're going to turn on the 'In-Place Editor'. We're going to click 'Save', and after this module is enabled we can go back and edit our existing panel. My favourite way to edit existing panels is to use the Contextual Administration link that appears on the page. It'll be in the top-right hand side of your panel area. You click on the cogwheel and you get an 'Edit panel' link. You click on the 'Edit panel' link and you get returned to exactly the correct place in the Page Manager interface. Now that we're here, we're actually going to change something that's not related to the display of this content; what we're going to change is the 'Renderer' that's used to display this page. And that's controlled under the 'General' category, on the left-hand side. So we're going to click on 'General', and now that we're here we're going to check on the 'Renderer' settings. When we first set up this panel, the only option that was available here to us was 'Standard', but now we turned on the 'In-Place Editor' module, there is a new 'Renderer' called the 'In-Place Editor', which we're going to select. So we're going to select that, 'Update and save' our panel, and return to the front page to have a look at it. Now that the 'In-Place Editor' is turned on you'll notice a new black bar at the very bottom of the page, with a button in it that allows you to customise this page. We can click on this button, and now the content of the actual page becomes editable. So now you can drag-and-drop your content into different places on the page, and in addition to re-arranging content you can also change the way that it's configured. So if you wanted to delete a panel pane, you could do that. If you wanted to change the way it looks, there's a style palette where you can choose, for example, if you want this advertisement to have rounded corners. You can also change the configuration options, so if you decided to wanted to title to be changed you can do that too. All of these changes happen real-time in the page, so you can see what they actually look like, and when you click 'Save' all of your changes become permanent. This is the kind of interface that anyone who's building a website can wrap their head around, that they'll understand exactly what they're doing, and it'll be very intuitive and friendly for them to use. This is a definite improvement over the custom-coding you would need to do to add custom regions and tiered themes, and the administration that needs to be done in order to add blocks into those regions. I hope that you like what you've seen about Panels so far. You can continue watching this series because there's lots more I'd like to show you. Thanks a lot!

Video Details

Duration: 9 minutes and 52 seconds
Country: United States
Language: English
License: All rights reserved
Genre: None
Views: 62
Posted by: drupalizeme on Oct 25, 2012

Drupal would like to assume that every page on your website will use the same layout. As it turns out, this is often not the case. The home page of your site, in particular, regularly uses a different layout. In this lesson we will demonstrate how you can use Panels to build a unique home page layout for your site.

Caption and Translate

    Sign In/Register for Dotsub to translate this video.