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

damiankloip’s picture

This 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?

massiws’s picture

Yes, 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.

damiankloip’s picture

You could always have something like:

<?php if (($top1 || $top2 || $top3) && $is_front): ?>
          <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 -->

So the if statement if only rendering your projects div on the front page. Then it covers both requirements...

massiws’s picture

Sorry, 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!

damiankloip’s picture

I think what you need is just not to put a float on your #projects div everything else will then sit underneath that.

massiws’s picture

everythins but the sidebar left!
http://inforsim.it/desbri

damiankloip’s picture

You need to NOT float the #progetti div then DO float the others I think....

massiws’s picture

I tried to remove the float:left div#projects, but nothing seems to change...
Sidebars are already float:left

damiankloip’s picture

It 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.

massiws’s picture

Like your navigation div comes after the content but appear above it?? I'm not sure this is right

That's the Basic theme!
Later, I look better to the code: now I'm trying another way.
Thanks

damiankloip’s picture

It'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...

massiws’s picture

Mmhh, 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?

damiankloip’s picture

The 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?

massiws’s picture

Thanks 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.

damiankloip’s picture

Status: Active » Closed (works as designed)