Last updated March 20, 2013. Created by George2 on April 11, 2009.
Edited by chrisjlee, jbrauer, trailerparkopera. 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:

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.

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

Comments

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 ?

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

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

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

Is this possible with Blocks also?

Eric