Flipped Table Style

Events happening in the community are now at Drupal community events on www.drupal.org.
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

Posted by smk-ka on April 11, 2010 at 7:22pm

but then it will affect all tables which is not what I want.

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

Posted by nadam on April 12, 2010 at 5:53am

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?

Posted by nadam on April 16, 2010 at 8:58am

I still haven't found a solution to this. The $header variable is missing. Should I create a bug issue for this?

YES!

Posted by nadam on April 16, 2010 at 9:29am

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...

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /