(Tips) Custom Drupal Templates by Path

Custom Drupal Templates by Path

Drupal Template Suggestions

Drupal's standard template naming works like the following example according to this information.

 

For example, if you were to visit example.com/node/1/edit, PHPtemplate would look for the following templates, in descending order:

page-node-edit.tpl.php
page-node-1.tpl.php
page-node.tpl.php
page.tpl.php

That's all fine and good, and works as expected. However, while working on iShrink.org yesterday, I needed something a little different than I usually do. Each of the main pages on that site require a completely different template, and as the site nears completion, several of the core pages will probably completely change layout. This poses the need that all of those pages have their own page.tpl.php template file.

 

Using the built in Drupal template suggestions, for the about page at iShrink.org/about, I could use the template page-node-1.tpl.php. As well as using page-node-2.tpl.php for the page at iShrink.org/services.


[Read more..]

Courtesy : http://himerus.com