Closed (won't fix)
Project:
Panels
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Apr 2007 at 09:51 UTC
Updated:
22 May 2009 at 17:25 UTC
It seems as though the Panels module is not able to nest itself in a column of a new panel like the Dashboard module could?
In other words, making a 2 column panel and then embedding that panel into one of the columns in a 3 column panel to make a 4 column page. The Dashboard module could do this which made it very flexible.
I couldn't believe this was the case when Panels was described as a "complete replacement" for Dashboard. I tried using the custom content in Panels as a workaround but it doesn't really work. I hope I'm missing something here.
Comments
Comment #1
fjpulido commentedHi, I had the same issue, and I found a trick to solve this using panels:
1.- I created a 3-column panel, this would be the front page.
2.- I created a 2-column panel, this would be the embedded panel. When you save this panel be sure to get the panel-ID ($did), you can get this id on the URL path by editing the panel. You can also get this ID by accessing de panels table on your drupal database (I can't remember the panels table's name right now, I think it was called panels-info or so, anyway it's easy to find)
3.- Add some content on your new 2-column panel using views or whatever you want.
4.- Next, create a new block. Write the following php code on body block:
Note that panels_panels_page is included on panels.module file.
4.- Edit the 3-columns panel and then insert the block you created on step 4 inside your preferred column.
5.- Save the block and check the output. That worked for me ;)
Hope this help.
Comment #2
greygoo commentedThanks fjpulido for the detailed instruction. It's not working for me though... I have a few questions.
What do you mean by Step 3 of your instructions? How do I add content on my 2 column panel (with views or whatever else)? Do you mean to create a view with the views module?
What I did:
1. - Created a 2 column panel.
2. - Created a new block and added the following:
<?php panels_panels_page(4) ?>(4 being the panel id of the 2column panel, which I got from hovering over the edit link which showed /admin/build/panels/edit/4)3. - Added the block in the top column of a stacked three column panel.
Nothing shows in the top column of the panel page. The 2 column panel when viewed by itself shows up fine. What am I missing? My guess is that I got the block code wrong? Or "adding content" to the panel is the crucial step I'm missing and not understanding?
Comment #3
greygoo commentedFollowing up on my own post, the block code was incorrect. This was the code that sorta made it work for me:
The only problem now is that while the 2 column panel is finally showing in the top column of my stacked 3 column panel, the top column is displayed as a 3 column. So the 2 columns take up the space of the first two left columns of a 3 column layout on top, instead of getting a true 2 column on top. I hope that makes sense. What I'm trying to achieve is 2 columns on top and 3 columns below that.
Comment #4
fjpulido commentedHi noborders, I forgot to write the "print" sentence on code, sorry!!! :p
About your problem in your top column... Maybe there is some panel css class which is limiting the width of columns.
For example:
If you are using the 2 column panel layout, you can see the following class on /drupal/modules/panels/layouts/twocol.css file:
Try to remove the "width" attribute from these classes.
If the solution above doesn't work, perhaps another parent css class need to be fixed.
Comment #5
greygoo commentedI tried removing the width attribute from those classes but it did nothing. I've also tried specifying a css class for that specific panel (
2coltopin my example), which creates a css id in the panel-2col div.But haven't been able to figure out how to use it. I've tried stuff like this to no avail:
#2coltop div.panel-col-first { width: 250px; }It's weird how the 2 column panel on top seems to be affected by the 3 column panel below it, as they behave more like they're supposed to be a 3 column panel with only the first two left panels being used. The same 2 column panel, when viewed by itself shows up correctly as a 50/50 split 2 column.
Comment #6
fjpulido commentedI tried the same but I'm not having that problem with 3 colums stacked layout. Perhaps the problem is on the template styles defined for node content on styles.css file of your drupal theme. Maybe one of them have some "width:" attribute defined. I'll keep investigating.
Comment #7
greygoo commentedI'm using bluemarine but I'm having this problem on all themes I've tried. What theme are you using?
Comment #8
fjpulido commentedI'm using a very customized bluemarine theme. But I tried to use a 3 colums stacked layout (threecol_33_34_33_stacked) and a 2 columns layout with the original bluemarine theme and finally I got it!!. Just add the following classes to styles.css file:
This is working for me right now using the original bluemarine theme.
Comment #9
greygoo commentedHmm.. I feel like I'm getting there but not quite. I'm also using threecol_33_34_33_stacked layout with 2 column on top using bluemarine on Drupal 5.1.
I tried using the css you specified in my theme's style.css but that didn't change anything. I then tried using the same css in the twocol.css in the Panels module's layout directory, which made the 2 columns on top stacked on top of each other (the column on the right goes below the left column), although the interesting thing is when they're stacked on top of each other like that, they're taking up full half of the space like it should...
Here's a visual example of what I'm talking about:
The original problem I was having:
http://img.photobucket.com/albums/v164/noborders/stuff/panelstest1.gif
Using your css
in twocol.css in Panel module's layout directory:
http://img.photobucket.com/albums/v164/noborders/stuff/panelstest2.gif
when I try the following css in the twocol.css,
I get this:
http://img.photobucket.com/albums/v164/noborders/stuff/panelstest3.gif
Any more ideas?
Comment #10
fjpulido commentedOk, the main problem here is about style names on 2 cols and 3 cols layouts, they share the same css class name (panel-col-first and panel-col-last). I'm not an expert on CSS and I don't know how to solve this without a drastic solution, let's try this:
1.- Open the file "twocol.inc", it contains the following function:
2.- Change the css class name for
<div class="panel-col-first">and<div class="panel-col-last">.3.- Open "twocol.css" file and modify the corresponding css class names as you did on step 2.
4.- IT SHOULD WORK NOW!!! ;)
This is not an "elegant" solution, but is quick.
Comment #11
greygoo commentedThanks for sticking through this.
I changed those css class names in twocol.inc to .panel-col-one and .panel-col-two and then used the following css in twocol.css:
but that still gives me http://img.photobucket.com/albums/v164/noborders/stuff/panelstest2.gif
But this has me wondering if I'm doing something different than you since you said just using that css made it work for you so that you have http://img.photobucket.com/albums/v164/noborders/stuff/2col3col.gif, right?
Perhaps we're using different content in the columns? I have a page node in each of the 2 columns on top.
Comment #12
fjpulido commentedYou almost have it. I had the same problem with truncated columns too. I found which css classes was used for node content and I found they had some "margin" and "padding" attributes which I removed because that pixels was truncating the columns. Try to modify ".node" and ".content" css classes to remove margin and padding attributes.
To locate this kind of problems I use Firefox Web Developer Toolbar (https://addons.mozilla.org/es-ES/firefox/downloads/file/237/web_develope...). It has a tool to highlight page elements and can show you their associated css classes with their attributes. It will help you a lot.
All views I use inside panels provides blocks instead pages but I don't know if this is important for this issue.
Take a look to my test web server. I'm developing a front page with same layout as you want to get. I hope you find it useful.
Comment #13
fjpulido commentedYou almost have it. I had the same problem with truncated columns too. I found which css classes was used for node content and I found they had some "margin" and "padding" attributes which I removed because that pixels was truncating the columns. Try to modify ".node" and ".content" css classes to remove margin and padding attributes.
To locate this kind of problems I use Firefox Web Developer Toolbar (https://addons.mozilla.org/es-ES/firefox/downloads/file/237/web_develope...). It has a tool to highlight page elements and can show you their associated css classes with their attributes. It will help you a lot.
All views I use inside panels provides blocks instead pages but I don't know if this is important for this issue.
Take a look to my test web server. I'm developing a front page with same layout as you want to get. I hope you find it useful.
http://www.javier-pulido.com/drupal/portada_3columnas
Comment #14
merlinofchaos commentedWith the flexible layout, none of this self-embedding stuff should be necessary.
Comment #15
sinmao commentedI know it's been awhile, but now that you have four columns, how do you make those four columns even in width. What I got after this is two columns at the left that are half the size of the two columns at the right.
Comment #16
guojia commentedyou can add a new mini panel(with 2 columns) as a block, and embed it into the column as you wanted.
Comment #17
merakli commentedCan somebody share a set of instructions on how to embed a 2 column mini panel inside a 3 column panel page to accomplish a 4 column homepage like a newspaper homepage? (Drupal 6)
Comment #18
merakli commentedI think the flexible layout is already doing this. From Canvas you can add as many columns as you want. Cool! I will see if I can add views or blocks into these columns.