Right now, when the page template variables are created all the regions are created and rendered. Regions are not available in other template files, such as the node or views templates, unless someone adds them in.

So, instead of generating all of the rendered html for all of the regions in the template_preprocess_page function we add an object to the region that can render a regions html when it's called.

So, in drupal 6 we would do:

  print $region_name;

Instead we would do:

  print $region->name;

When this call is made the region is rendered. If it's not called we never render the region.

This would give us the ability to expand region usage without taking a performance hit.

Comments

mfer’s picture

Issue tags: +Needs design review

adding tag...

mfer’s picture

So, right now I'm not so sure about doing this.... I'm open to other thoughts.

The regions are populated by blocks using block_page_alter and the page is rendered with drupal_render. If the blocks are specific to a particular callback then we don't have to worry about them loading when not needed.

Zarabadoo’s picture

As a themer, I really do like the idea of the flexibility this would offer. Are there any sort of performance caveats that this would introduce?

mfer’s picture

@Zarabadoo what is it about this you like?

Drupal 7 has a new rendering setup. I'm not sure if this can easily be done now. hrm...

Gábor Hojtsy’s picture

I brought up having more regions and more blocks last spring on the development list: http://lists.drupal.org/pipermail/development/2008-February/thread.html#... Among other things, people suggested to have a function call instead of a variable for themes, so the function call would gather and render blocks for that region. That is "autoloading" in a procedural sense. However it is implemented, we need a way to not generate what we don't use obviously, so I completely agree that this needs to be done.

effulgentsia’s picture

Title: Autoload Regions when they are called » D6: Autoload Regions when they are called
Version: 7.x-dev » 6.x-dev

I believe this is addressed well enough in D7 via block_page_build() to the extent that regions only apply to pages, the theme info file specifies the regions used by the theme, and the block module knows the blocks that are enabled for the page. I like the idea of expanding the concept of "regions" to things other than pages, like nodes, but that's a feature request perhaps better left to a BETTER_BLOCK.module in contrib, maybe to be added to D8's block.module if it proves itself. Please set version back to 7.x-dev if you disagree with my reasoning and think there's something that can be successfully improved for D7.

For D6, I suspect this is a "won't fix", but given #5, I'll leave that decision to Gabor.

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.