Drupal 7 Template Overrides
If you are designing your own templates for Drupal 7, then there is a pretty good chance that you might want the frontpage/homepage layout to differ from the rest of the pages on your website. Both Drupal 6 and Drupal 7 (maybe earlier versions as well, I have not used them) allow you to create template overrides to style individual pages. By default Drupal uses a set of tpl.php files for themes. Some of them include..
- page.tpl.php - This is the main template for the site. It includes where your module regions will be as well as your main content section

- node.tpl.php - This is where your content area is formatted. Things like the node title, comment area, links, etc.
- block.tpl.php - This is the format/layout of your sites blocks
- region.tpl.php - This file is the actual regions in the block
There are more template files but these are the main files.
Template Overrides
If you are designing Drupal themes you probably know this but custom themes should go in the sites/all/themes folder. If you do not have a /themes folder, just create it. Modules that are not part of Drupal's core should go in sites/all/modules folder. If you do not have the .tpl files above, you can get them in the /modules/system folder. These are the base system .tpl files. Once you have those in your custom theme file you can create custom pages by renaming the tpl files.
Custom Homepage Theme & Layout - To use custom homepage styling, open the page.tpl.php file in a code editor and save as page--front.tpl.php (with two dashes) (One dash page-front.tpl.php for Drupal 6) and upload it to your server. Clear your cache by going to configuration->Performance->Clear All Cache. Then referesh the page. Now your homepage is using page--front.tpl.php as it's template file. You can edit it as you want and only the homepage will use the changes.
Custom Inner Page Theme & Layout - You can do the same thing for inner pages by content type. Say you want a 2 column layout for your blog but your site is a 1 column. You can create a content type in Drupal called "blog" then create a file called page--blog.tpl.php and you can make the 2 column layout for all pages with "blog" content.
Custom Nodes - Say that you want your main "blog" nodes to have a different background or title color, etc. You can do the same thing with the node.tpl file. Create a file called node--blog.tpl.php and now you can edit blog content node styles and functions.
Remember to clear the cache after every new file upload or you will not see the changes.
Latest Blog Comments
-
Joomla 3.0 is Adding Slashes Automatically
13.06.2013 16:47Thank you very much! -
Remove "Powered by Phoca Gallery" Version 3.2.3
11.06.2013 19:45I just created a new post for Phoca 3.2.5 and 4.0 ... -
Types & DIfferences of SSL Certificates
08.06.2013 22:07I didnt knew of SSL certificates. There are many types of SSL.












HEADER
Send me URL please!!!
It is the best program for mass posting on forums! XRumer can break most types of captchas!
Send me URL please!!!
It is the best program for mass posting on forums! XRumer can break most types of captchas!
RSS