views

Get Views in Drupal Core - Please Contribute

Submitted by ravisagar on Sat, 07/28/2012 - 06:12

Today I was browsing the Drupal Views page and I came to know that the project owners are trying to get View into the Drupal Core in Drupal 8. That would be so Awesome. Just like CCK which is now part of Drupal 7. If you want to contribute then please ChipIn.

Table view with rows/columns switched

Submitted by ravisagar on Fri, 04/03/2009 - 05:35

These days I am working on my other site www.ggsipu.info to build the database of all the colleges affiliated to GGSIPU. I created a Custom Content Type to have various fields like college address, phone, fax, email, rating, etc. During the counselling time the students wants to compare various colleges based on various parameters like infrastructure, campus and other things. Now I wanted to create a view where a table is shown with the names of the colleges in the header and these parameters on rows.

  1. This views snippet allows you to render a tableview with columns and rows switched. Suppose you have the following output:
  2.  
  3. Title   | Price 1 | Price 2
  4. ----------------------------
  5. Node #1 | $10     | $20
  6. Node #2 | $15     | $25
  7.  
  8. but what you really want is the node titles displayed in the header, and the prices as the rows:
  9.         | Node #1 | Node #2
  10. ----------------------------
  11. Price 1 | $10     | $15
  12. Price 2 | $20     | $25

I created a view table, but obviously it showed the college names in the rows as it is the dynamic part. I searched around a lot on drupal and google and found this amazing piece of code that transpose the rows/columns.

You just need to replace YOURTHEME with the name of the theme and VIEWNAME with the view name and that's it!

Ravi Sagar Newsletter

Want to contact me?

Life begins outside your comfort zone and that is where your courage is developed". Write to me by filling this form. For living I am an Atlassian Consultant who love both Jira and Drupal. I am the author of "Mastering JIRA" and "Mastering JIRA 7" books. I Love both JIRA and Drupal (a bit more). You can Write To Me and I will get back to you as soon as I can. Have a nice day!

Social Links