1

I want to create a new region within an existing region which is by default or is custom made. I have created a custom region called footer_top. I want to create a new region within this region, i.e, a nested region. What should i do...what code should i write in page.tpl.php and how?

Thanks

2
  • Why do you need to have nested region? I think you could simply have three regions instead, rendered in that order.
    – SGhosh
    Commented Feb 1, 2013 at 8:08
  • 2
    @SGhosh...i just want to learn
    – why
    Commented Feb 1, 2013 at 8:33

1 Answer 1

2

You can use the region.tpl.php

And add a template_preprocess_region to add the new region variable with in this region.

You can use the following code to add the region variable to the region.tpl.php

$variables['custom'] = block_get_blocks_by_region('custom');

So the over all process would be as follows.

first you would create a preprocess_region function as given below

function theme_name_preprocess_region(&$variables) {
  $variables['region_name'] = block_get_blocks_by_region('region_name');
}

next you would create a region template file called region--region_name.tpl.php

and print the variable $variables['region_name'];

1
  • So this will print another region inside one region. Both regions will be available in the blocks page for placing blocks right?
    – SGhosh
    Commented Feb 1, 2013 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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