Hi!
I have a code that is sitting in template.php file

function phptemplate_views_view_table ($view, $nodes, $type) {
  $fields = _views_get_fields();

  foreach ($nodes as $node) {
    $row = array();
    foreach ($view->field as $field) {
      if ($fields[$field['id']]['visible'] !== FALSE) {
        $cell['data'] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
        $cell['class'] = "view-field ". views_css_safe('view-field-'. $field['queryname']);
        $row[] = $cell;
      }
    }
    $rows[] = $row;
  }
  return theme('table', $view->table_header, $rows, array('cellspacing'=>'4', 'border'=>'1'));
}

Currently in a raw I have "Taxanomy Image" "Node: Title" "Node Total Hits" "Node Author Name" "Node Created Time"

I would like to set it that "Taxanomy Image" "Node: Title" "Node Total Hits" shows in one and "Node Author Name" "Node Created Time" show second raw just below it.

I have checked http://drupal.org/node/154084 but I didn't get the idea from pingers who have posted (using $row[] = )

If you can give me a little bit more info or an example I think I can make it.

Thanks

CommentFileSizeAuthor
#4 example.jpg8.25 KBwerushka

Comments

werushka’s picture

I would really appreciate some feedback.

marcp’s picture

It might help people visualize this if you posted a link to your site and a mockup of what you are looking for.

merlinofchaos’s picture

Priority: Critical » Normal

You bumped your issue after nine hours? And marked this critical?

Critical is reserved for things that make your site simply not work. This is a nice to have theming feature.

This queue gets a LOT of incoming traffic and not nearly as many people helping to read it. It sometimes takes days or weeks to people to get around to this queue. If you want more exposure try the forums, but please try and understand that marking an issue like this critical and bumping it on the same day is considered rude.

werushka’s picture

StatusFileSize
new8.25 KB

here is an example

werushka’s picture

it is totally my bad I am sorry

rj’s picture

I had 4 fields and I wanted the last field to appear on a second row. Here's what I did:

function zen_views_view_table_og($view, $nodes, $type) {
  $fields = _views_get_fields();

  foreach ($nodes as $node) {
    $row = array();
    // Add additional variable for second row field(s)
	$row2 = array();
    foreach ($view->field as $field) {
      if ($fields[$field['id']]['visible'] !== FALSE) {
		  // Switch depending on field name
		  switch ($field['field']) {
		  
		  case 'title';
			$cell['data'] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
			$cell['class'] = "view-field ". views_css_safe('view-field-'. $field['queryname']);
			$row[] = $cell;
		  break;
		  
		  case 'count';
			$cell['data'] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
			$cell['class'] = "view-field ". views_css_safe('view-field-'. $field['queryname']);
			$row[] = $cell;
		  break;
		  
		  case 'description';
			$cell['data'] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
			$cell['class'] = "view-field ". views_css_safe('view-field-'. $field['queryname']);
			$row[] = $cell;
		  break;
		  
		  // Field to place on second line
		  case 'subscribe';
			$cell['data'] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
			$cell['class'] = "view-field ". views_css_safe('view-field-'. $field['queryname']);
			$row2[] = $cell;
		  break;
		  }
      }
    }
    //Place $row into first row
	$rows[] = $row;
	// Place $row2 into second row
	$rows[] = $row2;
  }
  // You may need to go to your view and remove the field label for the table header to display properly.
  return theme('table', $view->table_header, $rows);

}
werushka’s picture

Thanks for the function it works great, is it possible group two rows as a block to make it easy to theme it with a div

ntripcevich’s picture

I'm trying to something similar to this in Views 2.3. Does anyone have any code for something similar for Views2 by any chance?
I guess that this is a drupal 5 / Views1 thread so this is a hijack.
I asked something similar here for d6
http://drupal.org/node/330554

Thanks!

esmerel’s picture

Status: Active » Closed (fixed)

suggestion provided for original issue.