How difficult is it to add two more regions?
I would love to add two more big (390px) blocks on the right. One on top and one beneath the right blocks. Maybe someoone can make a tutorial, so we can learn. :)

See screenshot: http://i37.tinypic.com/n5m1qq.png

CommentFileSizeAuthor
#1 newswire-extra-regions.patch4.4 KBJeff Burnz

Comments

Jeff Burnz’s picture

Assigned: Unassigned » Jeff Burnz
Status: Active » Needs review
StatusFileSize
new4.4 KB

Hi, this is a great suggestions and I will most certainly look at getting this into the core theme.

Its rather time consuming for me to explain how to do this (if someone else wants to then great), so for now I have attached a patch that will give you this feature.

In short here is what the patch does:

1) creats the two new regions - adds code to page.tpl.php, newswire.info and adds a class to layout.css
2) adds classes to style.css so you can style those two new regions different

Caveats:

1) only tested in Firefox3
2) only works if both the Right and Right_2 regions are active

Making this work without the Right and Right_2 regions being active means a very major modification to "function newswire_col_width" which I don't have time for right now (maybe in the future I will look at this).

If you need help applying the patch there's a very good guide on d.o for applying patches using "Cygwin", search for it in the documentation.

Preview:

http://i36.tinypic.com/2n8zvuw.gif

portait’s picture

Wow, this was fast. :)
Thank you very much for this patch. The layout possibilities are much greater with those new two regions.

Genbushi’s picture

Holy wowzers, this is a great theme & patch!
Definitely recommend putting the patch in the next revision.

I'm running it on a news aggregation site, patch works great!
(Warning, adult content)
http://www.g33kreport.com

Where can I donate to your efforts?

Jeff Burnz’s picture

@Genbushi - that looks great, thanks for the feedback re the patch.

I'll be looking at getting this into the next version, although ideally it would be great if you didn't need to have right & right_2 active, so you could just have the 2 big 390 regions active (if you wanted it that way). Its a bit of a mare to figure out the logic for the function (me not so smart ok...), but I'll do it eventually:)

If you'd like to make a donation please give to the Drupal Association, they do loads of great stuff and I am a member also, so thats where I'd want it to go, cheers!

http://association.drupal.org/donate

Jeff Burnz’s picture

Status: Needs review » Fixed

Added to latest release - thanks for the suggestions and feedback all, this is great new feature for Newswire.

janne’s picture

Just wanted to congratulate you on adding the new regions. (And thank Portait for suggesting them in the first place!) I've already put the top one to use and in my opinion it really gives the site a better feel.

AgentD’s picture

I'm trying out this theme and placed an image in one of these new regions (Right top box (390px)) but the only page it appears on is the /admin/build/block page. I have it checked to appear on all pages so I don't know why it isn't showing on any other.

Anyone else run into this?

Jeff Burnz’s picture

@Janne - hi there lancefestivalen guy - great stuff, your site is looking great! Dude, if only my Swedish was better I'm sure I'd enjoy reading your site, I can get the jist of it but I am so bad with my Swedish, even thinking about going back to folk highschool for regular lessons - I just go to get it sorted!

@AgentD - sounds like you dont have both the right sidebars active - the two new 390px regions only work if you have blocks in both the right and right_2 sidebars.

AgentD’s picture

I see now....thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

najibx’s picture

Status: Closed (fixed) » Active

how about add another one. The current one only works if both the Right and Right_2 regions are active.
In certain case, I only want 2 column ... but this one may not be that big maybe 300px only. So the content area can be expanded to 620px or so.

Jeff Burnz’s picture

Sorry but I wont be adding any more collapsible regions to Newswire, the logic behind the layout is already complex enough:)

najibx’s picture

To think about it...for multi purpose usage.
If I only want 2 columns either left or right.

I have a very small sidebar (left or right) and too large of the content area.

I can have the larger right only sidebar provided I must add two small columns, otherwise this large (390px) sidebar would not show up.

It does not really make sense to me. Even if I use panel for the frontpage, i still have other issues on other pages.

It's complicated enough too for me to customized it :-)

Thank you for taking your time into this.

Jeff Burnz’s picture

Status: Active » Closed (fixed)
najibx’s picture

Status: Closed (fixed) » Active

Hi,

can you provide info how to enable the (390px) without making the small column necessary. I change the if statement, it shows fine but, it's not place correctly on the right, but shift down. Then I might want to change 390px to 300px as per my initial plan.

Thank you.

Jeff Burnz’s picture

You need to rework the logic of PHP function that controls the layout (function newswire_col_width), modify or simply brutally over ride the CSS framework and, as you state, modify the conditional statements in page.tpl.php.

Its doable, but I havent figured out the logic that needs to go into the function, as you have to account for all possibilities & it started to get rather complicated which is why I elected to leave it as is, until such time as I figured out a better way of handling the whole shebang.

To change the widths you'll need to study the set of CSS classes in layout-DEV.css and modify the values used in page.tpl.php & function newswire_col_width.

najibx’s picture

I am good providing patches but here's how I get it done.
please note that $right_bottom_box is now come in the picture. Please consider this options in the future version ;

template.php

function newswire_column_count_class($left, $content, $right, $right_2, $right_bottom_box) {
  if ($content && $left && $right && $right_2) {
    $class = 'four-column'; // all four columns active
  }
  else {
    if (($content && $left && $right) or ($content && $left && $right_2) or ($content && $right && $right_2)) {
      $class = 'three-column'; // three columns active
    }
    else {
      if (($content && $left) or ($content && $right_bottom_box) or ($content && $right) or ($content && $right_2)) {
        $class = 'two-column'; // two columns active
      }
      else {
        if ($content != '') {
          $class = 'one-column'; //one column (content itelf) active
        }
      }
    }
  }
  if (isset($class)) {
    print $class;
  }
}
/**
 * Set the width of the content region.
 *
 * Adds a width selector to $content depending on the cols are being used.
 * To change the widths see 'layout.css' and choose the selectors that match
 * the widths you require. Be careful not to exceed width-48-950 (960px) unless you
 * modify the #container width.
 *
 * @param $left, $content, $right, $right_2
 *   The main column regions
 */
function newswire_col_width($left, $content, $right, $right_2, $right_bottom_box) {
  if ($content && $left && $right && $right_2) {
    $class = 'width-18-350'; //if 4 col, content will be 350px
  }
  else {
    if (($content && $left && $right) or ($content && $right_bottom_box) or ($content && $right && $right_2) or ($content && $left && $right_2)) {
      $class = 'width-28-550'; //if 3 col content will be 550px
    }
    else {
      if (($content && $left) or ($content && $right_2) or ($content && $right)) {
        $class = 'width-38-750'; //if 2 col content will be 750px
      }
      else {
        if ($content != '') {
          $class = 'width-48-950'; //if 1 col content will be 950px
        }
      }
    }
  }
  if (isset($class)) {
    print $class;
  }
}

somewhere in page.tpl.php

<?php if (($right_bottom_box) || ($right_2 && $right)): ?>
								<div id="right-bottom-box" class="width-18-350 last">
										<?php print $right_bottom_box; ?>
								</div> <!-- /right 2 -->
						<?php endif; ?>
	
		  <?php if (($right_top_box || $right_bottom_box) || ($right_2 && $right)): ?>
			   </div> <!-- /right cols wrapper  -->

Jeff Burnz’s picture

Thanks for the code snippets, hopefully I'll have time to take a closer look at this soon, any chance of a patch:)

Jeff Burnz’s picture

I'm going to close this for now, unfortunately I simply have no extra time to develop Newswire any further - thus we are now in maintenance mode until Drupal 7 nears release.

Jeff Burnz’s picture

Status: Active » Closed (fixed)