Drupal 6: How to add a new region to a theme

I added a new realm area to my .info file in the / sites / all / themes / [theme] directory. However, when I look at the Blocks page, the area is not visible and is not a selectable item in the dropdown menu. I also cleared the cache. What am I missing?

+2


a source to share


4 answers


If you have multiple themes enabled, make sure you view the desired theme on the block configuration page.

For example, if you have a custom_theme and garland enabled, there is a block configuration page for each one.



Go to http://www.example.com/admin/build/block/list/custom_theme to see the blocks for your custom_theme
Go to http://www.example.com/admin/build/block/list/garland , to see the blocks for the garland theme

etc. for all included themes

+2


a source


When you say you've cleared your cache are you actually referring to the theme registry? Or have you actually cleared the database cache? If you just cleaned your theme registry, it won't reflect the changes in the .info file. You can clear the cache with ...

  • Use the clear all cached data link or the button located in Administration> Site Configuration> Performance.
  • If the devel block is enabled (comes with the devel module), click the Empty Cache link.
  • Just go to the theme selection page under "Administration> Site Creation> Themes".

List from Drupal.org



It is also possible that the browser itself caches the pages. You can clear your browser cache as well as Drupal cache just to be absolutely sure.

If none of this works, can you place your regional assignment from the .info file?

+2


a source


I assume Drupal 6 is here, but in your andytheme.info, you added this region (see bottom line):

regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
regions[andyregion] = Andy Region

      

Remember that you need to add all regions if you add them to your .info file - they will not inherit from your base theme.

And, in your page.tpl.php, have you added a scope variable that needs to be printed somewhere? Something like that?

<div class="region andyregion"><?php print $andyregion ?></div>

      

Of course, he will be surrounded by whatever other things you need. Then clear the cache and see if it is in blocks.

Andy -

+1


a source


The following assumes using Zen as a basic template.

  • Open the file /sites/[yoursite]/themes/[yourtheme]/[yourtheme].info

    and scroll down to the place where there are loadsregions[xxx] = yyy

    The name of the machine is shown in brackets. The text after the equal sign is descriptive text used on the page admin/structure/blocks

    .

  • Open /sites/[yoursite]/themes/[yourtheme]/templates/page.tpl.php

    and add <?php print render($page['MACHINE-NAME']); ?>

    where you want the area to appear.

0


a source







All Articles