Ive been playing around with drupal 7 and views over the weekend

Im having trouble in getting some custom theming done with the unformated style
My issue is that I would like to be able to control the exact location of all my fields from the view - at the moment this seems to be controlled by the order in which they are created (though this can be changed, full control is not in one single location)

I've had a look at the api theme for some preprocess functions and have found this one

function mytheme_preprocess_views_view_unformatted(&$vars) {
  $view = $vars['view'];;
  $rows = $vars['rows'];
 // print_r($rows);
  //print_r($view);
  }

The issue here is that the rows variable is just an indexed array with a string output so its impossible to use this directly to modify the order, it also appears that you cant pass $vars['view']; to the tpl using

$vars['temp'] = $vars['view'];

My question is this, Is hook_preprocess_views_view_unformatted the proper location to change the order of my fields - the only way I could do it is to rewrite the $rows fields from using the $views object in the preprocess

What tpl files could be used to get access to the fields, $fields cant be accessed by all the relevant tpl.php(im using views-view-unformatted.tpl.php) - the tpl's appear mainly for appending html tags and not the actual content from $rows (remember this is mainly an indexed string) - there doesnt appear to be an object that is pasted to the tpl file like with the node object.

Personally I prefer using a tpl but with views, I was hoping that $views could be passed to the tpl but couldnt get this to work

Any input would be useful - I just wondering what of the many options is best for maintenance in the future

tks
M

Comments

philosurfer’s picture

Subscribing....

-
We are the cult of personality.
-