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:

theme_root
+ 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.

Comments

pixelpreview@gmail.com’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
            views-attach-display-node-content-view.tpl.php
        + display_name
            views-attach-display-node-content-view.tpl.php
ericpai’s picture

Is this possible with Blocks also?