Organizing your Views templates

Last modified: May 17, 2009 - 18:43

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.

and node view ?

pixelpreview - July 7, 2009 - 07:37

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 ?

webmaster for dynasite.be

Rescan Views Templates

mhunt - October 13, 2009 - 02:00

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

tomgf - December 10, 2009 - 18:39

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

 
 

Drupal is a registered trademark of Dries Buytaert.