3

Access all views-data from views-view.tpl.php

http://drupal.org

Hi,

Sometimes I would like to override an entire view with my own HTML and then just loop out all the data in there.

Let's say I have a view block called "recent_articles", then I'd set up a views-view--recent-articles--block.tpl.php.

My question is, what's the easiest way to get a hold of all the (raw) data the view is providing me? I don't want to have to override both views-view, views-view-list, views-view-fields etc etc, I would just like to keep this one view in one file and handle _everything_ from there.

I've found that a lot of the times this variable contains most of the fields I've checked in the view:

$variables['view']->result[0]

But sometimes it doesn't. I would really love it if I could just get an associative array of _all_ the raw data the view is spitting out so that I can do whatever I want with it.

Is this possible?

Regards

Edit: If I print_r() $variables['view'] there's a gazzillion things in it and it seems almost impossible to just get an array of the raw data.

I'd just love something like all the rows in $rows with each $row containing each $field like $field['title'], $field['description'] etc etc.

Thanks

Read »
Created by Dplanet 1 year 7 weeks ago
Category: Modules   Tags:

PSD to Drupal Theme

Drupal Development

Module Development

Get an Estimate

Best published scoops - Modules

Tags for Access all views-data from views-view.tpl.php

Recent comments