Posted by jmm42 on January 12, 2013 at 1:07am
I have a custom module (just as the API suggests):
function hook_custom_theme() {
if(isset($_GET['m'])) {
return "my_subtheme";
}
}This module works so long as 'my_subtheme' is defined, and enabled. And, since it is both defined and enabled, the subtheme works, partly.
I have a page.tpl.php for the subtheme 'my_subtheme'. In this subtheme, I have the following line:
<?php print render( $page['my_region'] ); ?> (#1)
I have the region 'my_region' defined in the [subtheme].info as:
regions[my_region] = My Region
I also have blocks defined in that corresponding region at '[site:name]/admin/structure/block/list/my_subtheme'. However, the mobile page doesn't display render( $page['my_region'] ).
Comments
Modifying page.tpl.php
I've replaced (#1) above, with the following:
<?php if ( $page['my_region'] ) {print render( $page['my_region'] ) . '<div>yes</div>';
}
?>
The page outputs the following content:
However, I do have the following (parallel / siblings in HTML structure):
<div class="clear-block" id="main">
<div class="region region-[my_region]">
<div class="block block-views" id="block-views-[my_region]-block_2">
<div class="content">
</div>
</div>
</div>
<div>yes</div>
</div>
The above shows that $page['spotlight'] exists, but doesn't properly display, hence the empty
Modifying page.tpl.php
If instead of (#1), I do the following:
<?php print gettype( $page['my_region'] ); ?>The outputted value on the page is:
Modifying page.tpl.php
This time I did the following change to (#1):
<?php print dsm( $page['my_region'] ); ?>And I was able to construct the following:
<?php if ( $page['my_region'] ){
print $page['my_region']['views_spotlight-block_2']['#markup'];
}
?>
Associated template suggestions
I was tripped up a few times trying to write template files for the 'subtheme'. Remember when acquiring the 'template suggestions', to goto the view > theme information > change theme to get the full template suggestions as defined in:
http://drupal.org/node/1089656