Posted by nadam on April 11, 2010 at 6:28pm
Hi,
I'm trying to create a style plugin to flip the rows and columns of a table in views 2 Drupal 6. I have previously made this using theming, but then it will affect all tables which is not what I want.
When doing this with theming I just created a views-view-table.tpl.php as described here. However, when trying to make the same thing in a style plugin I don't get the $header variable. What should I use instead to get the column headers that I now want to display in the first column of the flipped table? Or should I use another approach?
Thanks,
Adam
Comments
but then it will affect all
Wouldn't it be enough to give views-view-table.tpl.php a more specific name according to the theme information given in the views' basic settings?
-Stefan
Nope
I guess that would work if there was just one view. However, my site will have a growing number of views, so creating a new views-view-table.tpl.php for each one would not be ideal.
I also like the idea in general to have "flipped table" as a separate module, since there may be more people who need this functionality.
Actually, I would prefer it to be part of the standard table style in views similar to the horizontal/vertical setting for the grid style, but I don't have enough knowledge to make that happen.
/Adam
Bug in Views?
I still haven't found a solution to this. The $header variable is missing. Should I create a bug issue for this?
YES!
Finally it's working after adding a template_preprocess function:
function template_preprocess_views_flipped_table(&$vars) {template_preprocess_views_view_table($vars);
}
Still wonders whether it's a bug that I have to do this...