Monday, September 1, 2008

如何自訂block region(區塊範圍)?

0. template.php
1. page.tpl.php


//===

template.php:
function YOUR_THEMES_NAME_regions() {
return array(
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
...
);
}
?>



page.tpl.php code:

*** The location of < div class="sidebar_left" > ...</div> within the page.tpl.php determines the location of the div shown in the layout.

class="sidebar_left" corresponds to some CSS layout code, for example:
.sidebar_left{
width:25%;
float:left;
margin-right:2%;
overflow: hidden;
}


[ref] http://drupalsn.com/drupal-tutorials/custom-drupal-theme-regions

No comments: