3

As far as loading time is concerned I haven't seen anywhere, including the documentation, if there is a real advantage in using the context module to display sitewide blocks over the Drupal default block page.

For D7, some say Drupal loads all blocks for every page but displays only those that are visible. If so, then using context could dramatically speed up a site with many blocks. Others say D7 only loads the visible blocks.

But, which is it? Is it worthwhile to switch to context for block display? Does any one really know?

Thanks. :)

4

Yes you should. It is worth while to switch to Contexts (Irrespective of your case about site wide context blocks)

Reasons

  1. When you have blocks which appear only on a certain pages, the time taken for loading the block is saved.
  2. In one page you can have a block in region A and on other page you can have the same block in region B.
  3. When you change your themes you need not worry a lot about changing all the settings. You just need to make sure that they have common regions.
  4. You can think on a page by page and then assign blocks.
  5. Context has a simple and clean UI of its own, including drag and drop facility.
  6. It is not path dependent. It means you can use conditions other than the path to set a context.
  7. Can be extended with Context UI which can be a replacement for Panels and light weight too :)
  8. In addition to placing Blocks there are many more reactions as well.
  9. Contexts can be stacked meaning there can be multiple contexts for a single page. So you can have a site-wide context to place the headers and footers, then a node context which will perform something only on node pages and then one more context which will be active only on say node/33.
  10. In short think of it like Rules module for the Layouts.
1

Yes, it is definitely useful to use Context for block display versus the core Block module for the very reason that you mentioned - Performance will be gained when Drupal is not forced to render blocks for all Theme Regions, even if they are not displayed on the page.

I was shocked to learn that a resource intensive, Image Style dependent Views Slideshow block that appears only on my homepage was being generated by the system on every single page load in the site. In Context, I set a Condition of type "Path" to "front" and set the Views Slideshow block in the appropriate region and the block stopped being generated for all page requests.

Context can be a very handy tool to display blocks more efficiently and with finer granularity than core Blocks module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.