I created a view which is viewable at http://mysite.com/branch-locator. The view is being displayed by my page.tpl.php. How do I override this and use a new template file called branchlocator.tpl.php to display my view?


How specific do you need to be with the name of your template file? You should be able to create a page--branch-locator.tpl.php that gets picked up by Drupal's auto-detection mechanism. At least, that would have worked in D6 (minus the extra hyphen after page).

  • oh cool, i was doing views--branch-locator.tpl.php – John Aug 5 '11 at 14:39
  • this use of the page-- naming convention uses the path alias, so if your path to the view changes, you'll need to update the tpl file. – akalata Aug 5 '11 at 14:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.