Search code examples
drupaldrupal-themesregions

Creating New Region - No Joy in Drupal 7


I'm modifying Bartik to create a custom theme. From all that I've read, I'm doing things right but it still isn't working. I've cleared my cache a million times and still get these errors:

Notice: Undefined index: department_column_left in include() (line 191 of /Users/scott/Sites/HardwareNext/sites/all/themes/hn01/templates/page.tpl.php). Notice: Undefined index: department_content in include() (line 197 of /Users/scott/Sites/HardwareNext/sites/all/themes/hn01/templates/page.tpl.php). Notice: Undefined index: department_footer in include() (line 203 of /Users/scott/Sites/HardwareNext/sites/all/themes/hn01/templates/page.tpl.php).

Any help would be greatly appreciated!

Here's the hn01.info file:

name = hn01
description = HN - Template 01
package = Core
version = VERSION
core = 7.x

stylesheets[all][] = css/layout.css
stylesheets[all][] = css/style.css
stylesheets[all][] = css/colors.css
stylesheets[print][] = css/print.css

regions[header] = Header
regions[help] = Help
regions[page_top] = Page top
regions[page_bottom] = Page bottom

regions[featured] = Featured
regions[content] = Content
regions[sidebar_first] = Sidebar first

regions[department_column_left] = Department column left
regions[department_content] = Department content
regions[department_footer] = Department footer

regions[footer_firstcolumn] = Footer first column
regions[footer_secondcolumn] = Footer second column
regions[footer_thirdcolumn] = Footer third column
regions[footer_fourthcolumn] = Footer fourth column
regions[footer] = Footer

settings[shortcut_module_link] = 0


; Information added by drupal.org packaging script on 2012-11-07
version = "7.17"
project = "drupal"
datestamp = "1352325357"

... and here's the relevant code from the page.tpl.php file:

<?php if ($page['department_column_left']): ?>
  <div id="department-column-left" class="department-column-left"><div class="section">
    <?php print render($page['department_column_left']); ?>
  </div></div> <!-- /.section, /#department-column-left -->
<?php endif; ?> 

<?php if ($page['department_content']): ?>
  <div id="department-content" class="department-content"><div class="section">
    <?php print render($page['department_content']); ?>
  </div></div> <!-- /.section, /#department-content -->
<?php endif; ?> 

<?php if ($page['department_footer']): ?>
  <div id="department-footer" class="department-footer"><div class="section">
    <?php print render($page['department_footer']); ?>
  </div></div> <!-- /.section, /#department-footer -->
<?php endif; ?>

Let me know if there's anything I can clarify. I thought adding a region was as easy as adding to the .info file and then modifying the page.tpl.php file. Is there more?

Thanks in adavnce,

Scott.


Solution

  • OK, this was a weird one.

    After clearing the cache numerous times, as I said, I closed the browser and reopened it. That did not fix the problem.

    So, while I waiting for an answer here on the 'flow, I started navigating about in the admin menu. Went to "Configuration" and tweaked a image style and after I updated it ...

    the errors above simply went away.

    My new regions are in place and available. I've been using them all morning with no ill effects. So if you're confronted with my problem--before you sacrifice that chicken to the gods of Drupal--try going into a block, change something and then save it. It just may save your keyboard from a bloody chicken.