I have several pages that contain views and I need to add wrapper divs to these views. So say for example I have the following pages with views on them -

drupal/videos
drupal/articles
drupal/places

So i have a template file for each of these views that places wrapper divs around the $content variable -
page-videos.tpl.php
page-articles.tpl.php
page-places.tpl.php

The issue is that each of these .tpl.php files contains exactly the same code. I would like to just use one .tpl.php for all three but as drupal overrides templates based on path I dont know if I can....so is it possible to use one .tpl.php file for all three or will I need to keep using three separate files that all contain the same code?

Comments

dodorama’s picture

Try to override the views template instead.
Look inside views module folder (modules>views>theme) and copy the file views-view.tpl.php in your theme folder; then customize it at your will.
More information are available in the view creation screen under "theme information" and in Views2 documentation.
Empty cache too see your changes.

ltwinner’s picture

I had tried that already but unfortunately when using ajax with views the wrapper divs were getting duplicated when the filters were changed and it was badly messing up the pages.

Basically the wrapper divs have to be placed in a page-*.tpl.php file, for example page-videos.tpl.php, page-articles.tpl.php, page-places.tpl.php etc...So is there any way to just use one .tpl.php file for all of these?

ltwinner’s picture

Got it. Just altered $vars['template_files'] in mytheme_preprocess_page() to 'page-views' for the paths of my views.

vonny007’s picture

google mustardseed media, then go to video casts and look for the video on themeing views..