Last updated 20 March 2013. Created on 11 April 2009.
Edited by chrisjlee, jbrauer, trailerparkopera, George2. Log in to edit this page.

When a site has a large quantity of views it can make organizing them and remembering what they do difficult. However it is possible to create a sub-directory inside the theme directory and organize the template files in a sub-directory. If a site has many views it is possible to further separate these into additional sub-directories.

This is one possible structure:

+ views
  + view_name
    + display_name (with template files inside)
    + another_display_name (with template files inside)
  + another_view_name
    + display_name

When the theme registry is cleared, the sub dirs will be registered as containing the template files.

Looking for support? Visit the forums, or join #drupal-support in IRC.


pixelpreview’s picture

is it possible to store the node-view-nameoftheview.tpl.php in these folder too ?
If it's possible, which name to choose for the template ?

meerkat’s picture

Doesn't look like it - they've got to go with node.tpl.php

mhunt’s picture

It is important to note that if you move views templates into a views folder, you will need to go back and click 'rescan templates'. This is found on the actual view edit interface. Lower left look for 'Theme: Information'.

tomgf’s picture

Is it possible to have .tpl.php files with the same name in those different directories?

Would it be possible to have something like this?

+ views
    + view_name
        + display_name
        + display_name
ericpai’s picture

Is this possible with Blocks also?