I am creating a big Drupal theme with lots of node types and lots of custom templates. Each having a very diffent look and feel. This is something I can not get round because the design was signed off before Drupal was decided as a platform. I wish to organise my files into folders.

templates/content_type/node-content_type.tpl.php

So for example

templates/page/node-page.tpl.php
templates/blog/node-blog.tpl.php
templates/node.tpl.php

The problem is drupal only scans for the templates files in the same folder as node.tpl.php.

Is it possible to get Drupal to scan into subfolders? Even if I need to hardcode where to look I don't mind.

Views does something which means it can look in subfolders but I don't know if that is because it defines its own type rather then a core type (node/page).

  • 1
    The Views module is not using a content type to show its results. – kiamlaluno Aug 3 '11 at 13:59
  • Sorry I meant that views can define tempalte files in subfolder locations and they are picked up and used. – William Aug 3 '11 at 14:08

In D6, any custom templates (from core, such as node or page) must be in the same folder as the base tpl file in order to use the auto-recognition of theme files.

You may be able to specify additional template files (in D7 they're called theme hook suggestions) in a preprocess function in your theme's template.php. See the first code example at http://drupal.org/node/249726 to get you started.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.