Hi All,
I'm quite new to drupal(around 3 weeks now and loving every minute of it:-) ) and have successfully themed a node to how I want. I am now using a view(table type) on taxonomy and would like to overide its default theming. I have read all that I can find on the theming page http://drupal.org/node/42597
All I'm after is access to the fields on each row. So when I get
StockID : Price : image: description: type :
222 : 45 : 2.gif : old : small
443 : 22 : 5.gif : newish : large
I would like to be able to space the fields out, add in a $ sign in front of the price. Maybe apply some css to it.
I have defined an overide function in template.php and can remove the output completely by commenting out the cell[data] field.
function phptemplate_views_view_table_taxonomy_term($view, $nodes, $type) {
$fields = _views_get_fields();
foreach ($nodes as $node) {
$row = array();
foreach ($view->field as $field) {
$cell['data'] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node,$view);
$cell['class'] = "view-field view-field-$field[queryname]";
$row[] = $cell;
}
$rows[] = $row;
}
return theme('table', $view->table_header, $rows);
}From here I'm not sure exactly how to overide the the theming of the fields and am guessing I need to do something with this cell[data] field. I'm pretty sure it will be something simple but it is not obvious to me.
Any help would be really appreciated.
Comments
Check out:
Check out: http://api.drupal.org/api/4.7/function/theme_table
For views I find it easier to use a list view. Then I use the view theme wizard to generate a template that I adjust to suit my needs. Of course there's many different ways to do things in drupal. :)
- China Business News & Observer -
cheers for that, I managed
cheers for that, I managed to overide the individual fields and put in what I needed.
I looked at the list and it seems really good, but I need the table header sorting. Although I could have used javascript for creating a table and sorting I also need paging and wasnt sure how my javascript table sorting would handle that. So for now I'm sticking with the table view.
Just quickly I have two taxonomy terms (make, model) in my table and have a filter on them, but the table doesnt give me the option for sorting on those two columns. Seems a bit strange, as when setting the views up there was no option for taxonomy to sort like normal fields.