Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

How to Create Drupal Themes for Different Content Types and Pages

Submitted by on March 18, 2010 – 5:15 amNo Comment

This article is for web-developers who are interested in creating their Drupal themes. It would tell you how to create themes for different content types. As a bonus, you’ll get know how to create theme for an individual page (the default theme will be used for other site pages). Let’s start!

Theme for content type

Usually a few content types are used for Drupal-based site. And every content type should have unique appearance. There is pretty simple solution for this.

Open folder containing the default theme for your site and create the following file there:

node-{type}.tpl.php

where {type} – is name of the required content type.

View the folder. You will see node.tpl.php file there. It is the default file which defines the standard appearance of every content type.

Copy content of node.tpl.php to node-{type}.tpl.php and modify it according to your needs. From now, content of the specified content type will appear according to node-{type}.tpl.php.

Theme for page

Sometimes you may need to change theme for some page on your site (for example, http://site/my/page). And other pages should use the default theme.

Open the folder which contains theme for your site and create page-my-page.tpl.php file there. So, name of the created file must consist of page-{next_argument}-{next_argument}.tpl.php.

Than copy content of the default page.tpl.php file to page-my-page.tpl.php and make the desired changes.

Attention! You should use system URL for the page. Make sure that there are no aliases there.

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.