First of all, thanks a LOT for creating this theme.

I'm creating a sub-theme using zurb_foundation as the base theme.

I would like a sidebar to the left of the main content for some pages, and on other pages I want the sidebar to appear on the right. I would like both sidebars to behave as per the sidebar example in the Zurb download, so that on a small screen the visible sidebar appears below the main content.

Here's the code, which works great for the left sidebar:

  <div class="row">
    <div id="main-content" class="nine columns push-three">
      <span>MAIN</span>
    </div>
    <div id="left-sidebar" class="three columns pull-nine">
      <span>LEFT SIDEBAR*</span>
    </div>
  </div>

I'm very new to Drupal so I'd appreciate if someone could give me some advice on this.

Questions:
* Is there a way to do this with just HTML/CSS with Foundation?
* Should I be using something else to achieve this, e.g. panels?
* Should I create separate templates for the different layouts? And if so, is there a way to do this without repeating all of the markup/etc that is common between both?

Thanks in advance!

Comments

billyroebuck’s picture

Now that I've actually started editing the page.tpl.php, and I've taken a look around, I think it might be easier than I had thought.

I think I can check if the regions are empty in page.tpl.php, and only render the sidebars when applicable.

I'll post the code here once I figure it out.

Cheers.

billyroebuck’s picture

I just saw the code that calculates the number of columns, so I guess I just need to display blocks in the sidebars only in certain contexts. What's the best way to go about this?

Cheers

ishmael-sanchez’s picture

Status: Active » Fixed

I would like a sidebar to the left of the main content for some pages,

Code exists for dynamic sidebars by default so just make sure you have a block in one of those regions (See http://drupal.org/node/171224)

Is there a way to do this with just HTML/CSS with Foundation?

Use you can modify the template HTML by editing the page.tpl.php in the starter folder or use a page preprocessing function to change the grid widths (See http://drupal.org/node/223430)

Should I be using something else to achieve this, e.g. panels?

You could do this with panels there are custom panel layouts available for use if you like, but you don't have to use panels to get this to work, see point above.

Should I create separate templates for the different layouts? And if so, is there a way to do this ...

You could create template files or use proprecessing or check out #1893720: Best way to use Foundation elements? there are other suggestions on how to implement.

I just need to display blocks in the sidebars only in certain contexts

That functionality exists just by using Drupal core and the block system see http://www.dummies.com/how-to/content/changing-drupal-block-visibility-s... or use the context module.

billyroebuck’s picture

Great... this helps, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.