Getting Blocks into Nodes in Drupal 6 using regions and or node templates

Putting Drupal blocks into your Drupal page templates is a simple exercise: create block, go to "Site Building -> Blocks -> Theme_Name and put your block in whichever page region suits your page design.

If the default regions in your page template (the Drupal page.tpl.php file, found in your theme's folder) don't meet your requirements don't provide you with a place to stick your block, then you simply create a new Drupal region in your Drupal theme .info file, stick it in your page.tpl.php and add a little css to position and style that new region.

If your new region is only suited to a specific page type in your website - e.g. "Events", but not "News" or "Blog" - then simply create a page template just for that content type - so, page-events.tpl.php - and add your new region to that template. (Note: if you do not have a page template just for Events, you probably have a Drupal taxonomy term for it, or a distinct url alias for that, in which case you could simply go into Drupal blocks admin, select the block you wish to position and then use the filter options - by page, by role, etc - to include or exclude it from displaying.

Getting your Drupal blocks into a Drupal node is a bit trickier, but not by much:
The best and most flexible solution is to create a region for Drupal node templates (rather than the usual page templates), and then simple use the Drupal block admin page to place blocks in that region. Here is an excellent article on that technique:
http://www.systemseed.com/blog/drupal-6-how-embed-region-node
(Note: the one step beginners might find tricky is running the new variable through the theme function in the template.php file. That said the instructions in the article above are clear and simple).

If for some reason you need to inject your blocks directly into a node.tpl.php then these 2 articles should answer your questions:
http://www.wildkatana.com/blog/drupal-embedding-nodes-views-and-blocks-t...
http://drupal.org/node/26502

If your use case is that you want to embed or insert or get Drupal block content into particular published nodes on an ad hoc basis then do take a look at the Drupal "Insert Block" module http://drupal.org/project/insert_block . (Be sure to read the README.txt, i.e., after installing and turning on the module you must go to your Drupal input formats admin page and tick the box for the newly created 'insert block' filter.)

There are some other ways of getting Drupal blocks in to node content areas involving the node preprocess function in template.php, but that may be for another brief post.

Panels or Display Suite

Finally, the Drupal Panels and Display Suite modules should be mentioned. Both take over large chunks of the Drupal theming layer. In return they give you all sorts of cool ways of positioning and filtering content on both page or node levels. Each provides a good admin UI for doing much of the above with drag and drop (or mouse click) ease. A bit of a learning curve getting used to their interfaces, and how they take over Drupal theming, but then you get to do lots of layout stuff with the click of a mouse.

Content Categories: