I'm having a hard time finding info on theeming table views (created by the Views module). There is a lot of info and even a built in theme generator for list views, but nothing for table views. Google search and site search has turned up very little.
Specifically I am looking to change the table view to have a width of 100% and make use of the "even" and "odd" properties to implement Zebra stripes.
It seems that I should be able to do this with CSS in style.css, but I am not having very much luck doing that. Perhaps I ned to create a "views-table-VIEWNAME.tpl.php" file similiar to the "views-list-VIEWNAME.tpl.php" file which is created by the view theme generator for list view? If that is the case can anyone help me out with what that would need to look like?
In the end I am looking for a simple table view similar to that on the ubercart plug-in homepage (ubercart.com). I'm sure it is easier than I am making it.
Comments
List View to Table View (Hack)
I tried that but it didn't work. Don't remember what happened exactly, but I know I ended up going a different direction when I needed to do something similar. Here's how I did it, it's a bit of a hack...
1. I created a list view as normal
2. In the views-list-CONTENTYPE.tpl.php file, I put the following:
3. That starts the table and writes all the lines, but in order to close the table I found it expedient to address the problem at the page.tpl level. My table appeared on a page whose URL was "/about/staff", so I added the following:
...directly after the line that echoes $content.
Maybe a little fug, but it works.
-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com
-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com
Views classes
The Views output for a table appears to put the table in a div that can be addressed with the classes "view-content" or "view-content-VIEWNAME" where VIEWNAME is the name you gave your view when you created it. The css that addresses the "view-content" class will effect all divs created by the views module while the "view-content-VIEWNAME" will address only that one div.
To change any table contained within a "view-content" div you can do this in css:
If you want to change just a specific view then address it directly like this:
You can address the table headers, rows and data for a view similarly. To see how views names the css classes, view the source for your page.
If the function isn't called
If the function isn't called right away, try calling it by engine:
function phptemplate_views_view_table_TABLENAME($view, $nodes, $type) {}
Apart of the newer tpl filenames, you can still put those in the template.php of the theme (or include from it).
I'm using 4.7x. I want to
I'm using 4.7x. I want to theme my content in table view.
My default theme is B7(green).
But i didn't see any view-list-contenttype.tpl.php.
Where can i find it?
Any idea are welcome.