Views - Rewrite output of the field - with custom fields

linwj - May 6, 2009 - 03:55

scenario:
to sort by the collective taxonomy term weight of a node ( from a specific vocab)

$weight_average=0;
$tax_list = (array)$taxonomy;

foreach ($tax_list as $item) {
if ($item->vid == 2) { $weight_average = $weight_average + $item->weight; }   
# only pick up weight from a specific taxnomoy
}

if (count($tax_list)>0) {
$weight_average = $weight_average / count($tax_list);
}
print $weight_average;

is it possible for me to write my own field , eg: weight_average
and then views table sort to sort the records using this custom field afterwards ?

closed found my solution

linwj - May 6, 2009 - 07:31

closed

found my solution in
http://drupal.org/project/views_customfield

 
 

Drupal is a registered trademark of Dries Buytaert.