4

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).

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

1 Answer 1

3

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 agree to our terms of service and acknowledge you have read our privacy policy.

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