Render drupal regions in node


/ Published in: PHP
Save to your folder(s)

Enables the usage off regions in node.tpl


Copy this code and paste it in your HTML
  1. function themename_preprocess_node(&$variables) {
  2. // Get a list of all the regions for this theme
  3. foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {
  4. // Get the content for each region and add it to the $region variable
  5. if ($blocks = block_get_blocks_by_region($region_key)) {
  6. $variables['region'][$region_key] = $blocks;
  7. }
  8. else {
  9. $variables['region'][$region_key] = array();
  10. }
  11. }
  12.  
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.