Closed (works as designed)
Project:
Basic
Version:
6.x-2.12
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Jun 2011 at 01:48 UTC
Updated:
20 Sep 2011 at 05:50 UTC
Hi!
It's my first time with basic and I have some problems with positioning new regions.
I have to add 3 view-blocks only in homepage of my site just below the navigation bar.
I added 3 regions in the file MyTheme.info and added this code to the file page.tpl.php:
...
<div id="content">
<!-- add this -->
<!-- _____ Blocks _____ -->
<?php if ($top1 || $top2 || $top3): ?>
<div id="projects" class="clearfix">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="top-left">
<?php if ($top1) print $top1; ?>
</td>
<td id="top-center">
<?php if ($top2) print $top2; ?>
</td>
<td id="top-right">
<?php if ($top3) print $top3; ?>
</td>
</tr>
</table>
</div>
<?php endif; ?> <!-- /blocks -->
<!-- end -->
<div id="content-inner" class="inner column center">
...
<?php ... ?>
In style.css I add:
div#projects {
width:960px; /* fixed layout */
margin-top: 30px; /* navigation bar height */
}
td#top-left, td#top-center, td#top-right, {
position: relative;
width:320px;
height:250px;
overflow:hidden;
}
But in in this way my table go over the sidebars-left/right!
If I add padding-top to the sidebars I solve, but when I go to another page that's not home it's wrong: how can I style the layout of the two sidebars?
Have I to create a page-front.tpl.php? Or can I use Panels module?
Thank you
Comments
Comment #1
damiankloip commentedThis probably isn't the best scenario to be using a table, I would say nowadays you generally wouldn't want to be using tables for the layout of your template. Is there any other reason you need a table? It might be better to use divs instead to achieve this.
I'm not sure about panels, I don't really use it. I'm sure it's pretty good though! You could always create a page-front.tpl.php if it is a totally different layout. Are you still having a normal content region?
Comment #2
massiws commentedYes, it is true, I could use div instead table, but the problem remains the same: on the homepage I should display 3-block views just below the navbar, moving also sidebars down about 250px.
I thought I could make creating new regions, put block-views in those areas and select to display them only on homepage... but now I think the page-front-tpl.php is the better way.
Thank you.
Comment #3
damiankloip commentedYou could always have something like:
So the if statement if only rendering your projects div on the front page. Then it covers both requirements...
Comment #4
massiws commentedSorry, but maybe I have not explained the problem well.
The question is not how to display the blocks on the homepage, but how to move down the sidebars on the homepage ONLY.
The two sidebars are now float:left with margin-top:30px; the new regions (div id="projects") are also float:left.
How can I style the sidebars to be at the bottom of the new regions content?
How do I position the two sidebars below the new regions?
Thanks for your patience!
Comment #5
damiankloip commentedI think what you need is just not to put a float on your #projects div everything else will then sit underneath that.
Comment #6
massiws commentedeverythins but the sidebar left!
http://inforsim.it/desbri
Comment #7
damiankloip commentedYou need to NOT float the #progetti div then DO float the others I think....
Comment #8
massiws commentedI tried to remove the float:left div#projects, but nothing seems to change...
Sidebars are already float:left
Comment #9
damiankloip commentedIt looks like a bit of a mess in general i'm afraid! :-( I think there might be a few element in the wrong order etc... Like your navigation div comes after the content but appear above it?? I'm not sure this is right.
Comment #10
massiws commentedThat's the Basic theme!
Later, I look better to the code: now I'm trying another way.
Thanks
Comment #11
damiankloip commentedIt's the different floats that you are using I think...
If you put your #projects div above the #content div (but inside the #main div) then it should work...
Comment #12
massiws commentedMmhh, even this works... I think the positioning of the sidebars do not work with my template.
Has anyone ever added regions to Basic theme just below navigation bar?
Comment #13
damiankloip commentedThe sidebars should be OK, as long as they are in the #content div and the region you have added is not. If you paste your template into drupalbin I will have a look and try and help you get a fix if you like?
Comment #14
massiws commentedThanks damiankloip!
I don't know drupalbin: I will see ...
But the only changes I made in Basic theme are in the page.tlp.php adding the block of php code in the previous post (between
and
) and obviously in style.css.
No changes anywhere else.
Sorry, but I am now trying another theme that I know better: I have little time for this project!
Surely I will try again Basic theme in the coming weeks.
If you have bredcrumbs of time to investigate on my problem I will appreciate it very very much. ;)
Thank you.
Comment #15
damiankloip commented