How to change field label name in a view programmatically I want to change the views field label name programtically? I have written a views-view-field.tpl.php. but dont know to change the $output variable.
You can use hook_views_pre_render() for that.

Add this function to your template.php file:

function YOURTHEME_views_pre_render(&amp;$view) {

  switch ($view-&gt;name) {
    case 'name_of_your_view':

      // do some logic for your label
      $label = 'My dynamic label';

      // define the label value
      $view-&gt;field['fieldname']-&gt;options['label'] = $label;
      break;
  }
}


Now, the label value will be always as the logic result. No matter whether the label is defined via Views Ui or not, it will be altered by your logic anyway.