Welcome

Innovation distinguishes between a leader and a follower.

" นวัตกรรมแยกผู้นำกับผู้ตามออกจากกัน " Steve Jobs


Most Drupal themes have a number of pre-defined regions that you can use in your templates (.tpl.php) files. But what if you want to do something a bit more creative with your web site? For example, if you are using MD Minimal theme with only 3 block regions (highlight, help & content) and you need add social icons block in footer. So, here's a tutorial on how to create custom regions in your Drupal 7 themes.

Step 1: define the custom region in your theme's .info file

The .info file for your Drupal 7 theme will be located within the root of the theme's main folder. e.g. MD Minimal's .info theme file is located at: /themes/md_minimal/md_minimal.info
Open up your theme's .info file and you should see some regions like this:
?
1
2
3
regions[highlight] = Highlight
regions[help] = Help
regions[content] = Content
to add a new region just type in a new one in md_minimal.info file.
?
1
regions[footer_icons] = Footer icons

Print out your new region in page.tpl.php file:

?
1
2
3
4
5
<?php if ($page['footer_icons']): ?>
  <div class="footer-icons">
    <?php print render($page['footer_icons']); ?>
  </div> <!-- /.footer icons -->
<?php endif; ?>
Save file, clear your cache (go to admin/config/development/performance) and you will see the new region.
 
JUNCTION X © 2013. All Rights Reserved. Powered by Blogger
Top