2

I am new to Drupal and now maintaining a completed Drupal site and I am struggling to understand how it all came into existence :)

What I have gathered from poking around the current code base is that there is some kind of relation from a view you create in the admin section to a .tpl file, and for the life of me I cannot figure out what it is.... am I even on the right track?

Any help or good reads would be much appreciated!

1 Answer 1

3

Actually, a view will use many template files (which you can override in a theme if desired); it depends a lot on how you configured your view (e.g. style, content).

The most useful information can be found when you're configuring your View. Just click Theme: Information in the Basic settings pane of your View, and the View itself will give you a list of tpl.php files that are used for rendering. Don't forget that there isn't only one tpl.php - there are many, and they wrap each other a lot (they're nested). Reading about generic Drupal theming will help a lot. The same rendering basics are used for Views.

If you want a template file for one specific View, look at the suggestions given by "Theme: Information." You can override any template file, for a specific View only (identified by its machine-name). This is probably what you're asking for, actually.

A good link on the subject is Theming Views.

4
  • where is Theme: Information ?
    – niksmac
    Dec 13, 2012 at 13:57
  • Go to admin/build/views and edit your View. Look for the list of properties that specify Title, Style, Name, Header, Empty text, CSS Class etc. This list has the title Basic settings. At the very bottom of this list, you'll find Theme: Information. Can you find it? Try Ctrl+F when in doubt.
    – CamilB
    Dec 13, 2012 at 14:38
  • How do I override? I can't even see my .tpl for my view in the Theme information section.
    – rnho
    Dec 14, 2012 at 0:16
  • Here: Theming Views. Please note that this is the first search result for "theming views" in Google. We will help with everything we can here, but it's wiser to come only when all else fails, or there's no visible way out. Maybe you didn't know what to search for?
    – CamilB
    Dec 14, 2012 at 7:38

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.