2

I'm using a Bootstrap sub-theme and am using the templates directory to override the templates for specific pages and is working ok.

I'm looking at this page in order to override the template file for a specific view, have added the file with my view name inside the template folder but its not working. Neither I can find the Bootstrap original views-view-unformatted.tpl.php in the bootstrap folder.

Can anyone point me in the right direction?

3

This is how I template my views in bootstrap sub-themes with or without the bootstrap views module b/c sometimes you need to change those as well :)

First - In my sub-theme's for Bootstrap I make a folder called 'views' in the 'templates' folder (this is for sanity and structure, I think it works without the folder but don't quote me on that). There's only one view template in the bootstrap theme, for a responsive table so you can template anything however you want using the normal views templates.

You can also use the bootstrap views module mentioned in the other answer but you may still want to template those again in your subtheme so you will need the above folder '/templates/views' and now the documentation page you mention has some of the templates but views comes with a way to accomplish this without that page in the UI.

Loose instructions for views templates.

  • open a view in the admin view UI screen
  • look on the left hand column for advanced, expand if needed.
  • look to the very bottom of that column and you will see Theme: Information
  • click that link, pop up appears
  • this is your views theming information, you will see that the current template being used is in bold.
  • I usually go find that template beg used, copy that into my subtheme's '/templates/views' folder and choose from the list in the popup what I need to name the file, like for a view named "repair" I wouldn't want to use views-view.tpl.php and overwrite all the views display output, I would want to use views-view--repair.tpl.php so I name my file that and change something subtle.
  • then I go hit the rescan templates files button in the popup and my new template will be in bold.
  • I save the view and go make sure I did something productive.
  • don't forget to clear cache if you aren't seeing what you want to see, it usually pops up after that, if not double check your naming of the file.

Hope that helps, views templates rock and I use them a pretty good bit just let me know if that doesn't work.

  • Btw I didn't notice that the documentation page was for D6, so these instructions or for D7 but may work either way. – burnsjeremy May 22 '15 at 3:35
1

Maybe you should consider using the Views Bootstrap module? Here is an excerpt from its project page:

... enables you to create components following the theme structure of the Bootstrap framework all within the configuration settings of the powerful Views module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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