Ok I've been looking for posts on how to do this and nothing works for me. I'm using the My Drupal Impact theme. One thing to note here also is that the theme has no template.php file. Right now the themes regions that show up are only left sidebar, content, right sidebar, and footer. Header shows up as an option but it's not there. Now I've used the Zen theme before and the greatest thing about that that I really loved was content top and content bottom. I've had too much difficulty due to my lack of knowledge to either; change Zen theme so it wasn't clunky and plain, or add the two regions to my drupal impact theme.

Here is what the page.tpl.php looks like for zen

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language ?>" xml:lang="<?php print $language ?>">

<head>
  <title><?php print $head_title; ?></title>
  <?php print $head; ?>
  <?php print $styles; ?>
  <?php print $scripts; ?>
</head>

<?php /* different ids allow for separate theming of the home page */ ?>
<body class="<?php print $body_classes; ?>">
  <div id="page">
    <div id="header">
      <div id="logo-title">
      
        <?php print $search_box; ?>      
        <?php if ($logo): ?>
          <a href="<?php print $base_path; ?>" title="<?php print t('Home'); ?>">
            <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" id="logo" />
          </a>
        <?php endif; ?>
        
        <div id="name-and-slogan">
        
        <?php if ($site_name): ?>
          <h1 id='site-name'>
            <a href="<?php print $base_path ?>" title="<?php print t('Home'); ?>">
              <?php print $site_name; ?>
            </a>
          </h1>
        <?php endif; ?>
        
        <?php if ($site_slogan): ?>
          <div id='site-slogan'>
            <?php print $site_slogan; ?>
          </div>
        <?php endif; ?>
        
        </div> <!-- /name-and-slogan -->
        
      </div> <!-- /logo-title -->
     
      
      <div id="navigation" class="menu <?php if ($primary_links) { print "withprimary"; } if ($secondary_links) { print " withsecondary"; } ?> ">
          <?php if ($primary_links): ?>
            <div id="primary" class="clear-block">
              <?php print theme('menu_links', $primary_links); ?>
            </div>
          <?php endif; ?>
          
          <?php if ($secondary_links): ?>
            <div id="secondary" class="clear-block">
              <?php print theme('menu_links', $secondary_links); ?>
            </div>
          <?php endif; ?>
      </div> <!-- /navigation -->
      
      <?php if ($header || $breadcrumb): ?>
        <div id="header-region">
          <?php print $breadcrumb; ?>
          <?php print $header; ?>
        </div>
      <?php endif; ?>
      
    </div> <!-- /header -->

    <div id="container" class="clear-block">
                  
      <?php if ($sidebar_left): ?>
        <div id="sidebar-left" class="column sidebar">
          <?php print $sidebar_left; ?>
        </div> <!-- /sidebar-left -->
      <?php endif; ?>  
    
      <div id="main" class="column"><div id="squeeze">
        <?php if ($mission): ?><div id="mission"><?php print $mission; ?></div><?php endif; ?>
        <?php if ($content_top):?><div id="content-top"><?php print $content_top; ?></div><?php endif; ?>
        <?php if ($title): ?><h1 class="title"><?php print $title; ?></h1><?php endif; ?>
        <?php if ($tabs): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>
        <?php print $help; ?>
        <?php print $messages; ?>
        <?php print $content; ?>
        <?php print $feed_icons; ?>
        <?php if ($content_bottom): ?><div id="content-bottom"><?php print $content_bottom; ?></div><?php endif; ?>
      </div></div> <!-- /squeeze /main -->

      <?php if ($sidebar_right): ?>
        <div id="sidebar-right" class="column sidebar">
          <?php print $sidebar_right; ?>
        </div> <!-- /sidebar-right -->
      <?php endif; ?>

    </div> <!-- /container -->

    <div id="footer-wrapper">
      <div id="footer">
        <?php print $footer_message; ?>
      </div> <!-- /footer -->
    </div> <!-- /footer-wrapper -->
    
    <?php print $closure; ?>
    
  </div> <!-- /page -->

</body>
</html>

And here is what it looks like for My Drupal Impact

<?php
// $Id: page.tpl.php,v 1.1.6.3 2007/06/23 00:48:49 taherk Exp $

$color = 'orange'; //set to blue, black, green, orange, purple, brown, or red
global $base_url;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <title><?php print $head_title ?></title>
  <?php print $head ?>
  <?php print $styles ?>
  <?php print $scripts ?>
  <style type="text/css" media="all">@import "<?php print $base_url . '/' . $directory . '/colorcss/' . $color ?>.css";</style>
  <script type="text/javascript"><?php /* Needed to avoid Flash of Unstyle Content in IE */ ?> </script>
</head>

<body>
  <div id="container">
    <div id="sitename">
      <?php if ($logo) { ?><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" id="logo" alt="<?php print t('Home') ?>" /></a><?php } ?>
      <?php if ($site_name) { ?><h1><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><?php print $site_name ?></a></h1><?php } ?>
      <?php if ($site_slogan) { ?><h2><?php print $site_slogan ?></h2><?php } ?>
    </div>
    <div id="mainmenu">
      <?php if (isset($primary_links)) { ?><?php print theme('links', $primary_links, array('class' =>'primary_links')) ?><?php } ?>
    </div>
    <div id="wrap">
      <div id="leftside">
        <?php if ($sidebar_left) {
          print $sidebar_left;
        } ?>
      </div>
      <div id="rightside">
        <?php if ($sidebar_right) {
        print $sidebar_right;
        } ?>
      </div>
      <?php if ($mission) { ?><div id="mission"><?php print $mission ?></div><br /><?php } ?>
      <div id="content">
        <?php print $breadcrumb ?>
        <?php if ($title) { ?><h1><?php print $title ?></h1><?php } ?>
        <div class="tabs"><?php print $tabs ?></div>
        <?php print $help ?>
        <?php print $messages ?>
        <?php print $content; ?>
      </div>
      <br class="clear" />
    </div>
  </div>
  <div id="footer"><?php if (strlen($footer_message) > 2) { print $footer_message . ' | '; } ?>
  </div>
    <?php print $closure ?>
	<div id="copyright">
                Theme By: <a href="http://mydrupal.com">My Drupal</a>. Sponsored by: <a href="http://itdiscover.com">IT Discover</a> | <a href="http://techjobs.co.in">Tech Jobs</a> | <a href="http://csqa.info">CSQA</a>
  </div>
</body>
</html>

So can anyone please help me. I really want and need those two regions, they'll really help me to complete what I'd like to do with my sites. Thanks alot.

Comments

hsalazar’s picture

The fact that the MyDrupal_Impact theme includes no template.php file doesn't mean you can't create it yourself.

Create the file and include this single function:

function MyDrupal_Impact_regions() {
  return array(
       'left' => t('left sidebar'),
       'right' => t('right sidebar'),
       'content_top' => t('content top'),
       'content_bottom' => t('content bottom'),
       'header' => t('header'),
       'footer' => t('footer')
  );
} 

Then you'll be able to add into the theme's page.tpl.php file the lines pertaining to those extra regions:

<?php if ($content_top):?><div id="content-top"><?php print $content_top; ?></div><?php endif; ?>

and

<?php if ($content_bottom): ?><div id="content-bottom"><?php print $content_bottom; ?></div><?php endif; ?>

Good luck!

SymmetryPower’s picture

It didn't work.. and also where do I put those two lines in the page.tpl.php anywhere? Well here's what happend when I made the template.php.. oh and btw.. the MyDrupal Impact theme doesn't have a header region that shows up either.. sigh lol.. ok heres what happened..

Here's a Screenshot Link
http://www.i14.photobucket.com/albums/a317/icypinoy/Blocks|HOY-PARE.png

Sorry about the small image.. I used screengrab and accidentally did whole page.. but if you see that light space on the top.. that's where all the function stuff of the regions text show up..

Any clue on what to do? Anyone? Thanks again.

hsalazar’s picture

I modified the MyDrupal_Impact theme to include content top and content bottom regions. All you need to do is to be careful as to how the regions are called. Use the following code.

template.php

<?php
// $Id: template.php,v 1.12.2.1 2007/01/17 05:28:41 jjeff Exp $


/*
 * Declare the available regions implemented by this engine.
 *
 * @return
 *    An array of regions.  The first array element will be used as the default region for themes.
 *    Each array element takes the format: variable_name => t('human readable name')
 */
function MyDrupal_Impact_regions() {
  return array(
       'left' => t('sidebar left'),
       'right' => t('sidebar right'),
       'content_top' => t('content top'),
       'content_bottom' => t('content bottom'),
       'footer' => t('footer')
  );
} 

page.tpl.php

<?php
// $Id: page.tpl.php,v 1.1.6.3 2007/06/23 00:48:49 taherk Exp $

$color = 'black'; //set to blue, black, green, orange, purple, or red
global $base_url;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <title><?php print $head_title ?></title>
  <?php print $head ?>
  <?php print $styles ?>
  <?php print $scripts ?>
  <style type="text/css" media="all">@import "<?php print $base_url . '/' . $directory . '/colorcss/' . $color ?>.css";</style>
  <script type="text/javascript"><?php /* Needed to avoid Flash of Unstyle Content in IE */ ?> </script>
</head>

<body>
  <div id="container">
    <div id="sitename">
      <?php if ($logo) { ?><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" id="logo" alt="<?php print t('Home') ?>" /></a><?php } ?>
      <?php if ($site_name) { ?><h1><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><?php print $site_name ?></a></h1><?php } ?>
      <?php if ($site_slogan) { ?><h2><?php print $site_slogan ?></h2><?php } ?>
    </div>
    <div id="mainmenu">
      <?php if (isset($primary_links)) { ?><?php print theme('links', $primary_links, array('class' =>'primary_links')) ?><?php } ?>
    </div>
    <div id="wrap">
      <div id="leftside">
        <?php if ($sidebar_left) {
          print $sidebar_left;
        } ?>
      </div>
      <div id="rightside">
        <?php if ($sidebar_right) {
        print $sidebar_right;
        } ?>
      </div>
      <?php if ($mission) { ?><div id="mission"><?php print $mission ?></div><br /><?php } ?>
      <div id="content">
        <?php print $breadcrumb ?>
        <?php if ($content_top):?><div id="content-top"><?php print $content_top; ?></div><?php endif; ?>
        <?php if ($title) { ?><h1><?php print $title ?></h1><?php } ?>
        <div class="tabs"><?php print $tabs ?></div>
        <?php print $help ?>
        <?php print $messages ?>
        <?php print $content; ?>
        <?php if ($content_bottom): ?><div id="content-bottom"><?php print $content_bottom; ?></div><?php endif; ?>
      </div>
      <br class="clear" />
    </div>
  </div>
  <div id="footer"><?php if (strlen($footer_message) > 2) { print $footer_message . ' | '; } ?>
  </div>
    <?php print $closure ?>
	<div id="copyright">
                Theme By: <a href="http://mydrupal.com">My Drupal</a>. Sponsored by: <a href="http://itdiscover.com">IT Discover</a> | <a href="http://techjobs.co.in">Tech Jobs</a> | <a href="http://csqa.info">CSQA</a>
  </div>
</body>
</html>

This will give you the desired regions in the template. You can extend this principle to any region in the page, so you see how powerful Drupal and in particular its capabilities are. Cheers!

SymmetryPower’s picture

Hey that works great.. thanks a lot I really appreciate it.. I still don't get though why there's no header section.. and now I got to get the drop down admin menu working again..but it's wonderful to have these sections.. and yes I wish I knew more about harnessing drupal power.. at least I know its there.. thanks again!

hsalazar’s picture

Just to complete this thread, SymmetryPower asked about how to put a different background in the just-created top and bottom regions. This is an easy one. As it can be seen in the above code, the regions are referred to within div tags calles "content-top" and "content-bottom", so the answer is simply this: add the appropriate selector(s) in style.css:

div#content-top {
	background-color: #DDEEFF;
	padding: 3px 12px;
}
div#content-top {
	background-color: red;
	padding: 3px 12px;
}

if you want different styles for each region, or

div#content-top, div#content-bottom {
	background-color: #DDEEFF;
	padding: 3px 12px;
}

if you want to style them both the same.

Cheers.

P. S.: As to why the template has no header region, just remember this is a convention, you might as well call it "topmost" or "highestone" or whatever suits your fancy. As long as you declare it in template.php and then include it with the appropriate HTML syntax in page.tpl.php, you should have no problems.

igbonine’s picture

I just installed inpact and ran into same prroblems.
Great.

pepemty’s picture

Just subscribing.

Warm regards from sunny México!
Pepe
:-)

Warm regards from sunny México!
Pepe
:-)