how to programmatically alter the rendering of a field in Views I have a content type called 'Ping'. It has several fields and one of them is a url by the name 'filename'. I want the View of all such pings, names 'user-pings' to display not the url itself, but a link to it. How do I do that?

I've tried the following, but it doesn't work:

function feedback_views_pre_render(&amp;$view)
{

    if( $view-&gt;name === 'user_pings' )
    {

        foreach( $view-&gt;result as $key =&gt; $val )
        {
           $lang = $view-&gt;result[$key]-&gt;_field_data['nid']['entity']-&gt;language;
           $field = $view-&gt;result[$key]-&gt;_field_data['nid']['entity']-&gt;field_filename[$lang][0];
           $filename = $field['value'];
           $link = "&lt;a href='$filename'&gt;(download)&lt;/a&gt;";
           $view-&gt;result[$key]-&gt;_field_data['nid']['entity']-&gt;field_filename[$lang][0]['value'] = $link;
           $view-&gt;result[$key]-&gt;_field_data['nid']['entity']-&gt;field_filename[$lang][0]['safe_value'] = $link;

        }

    }

}


Additionally, if this code is a try in the right direction, I would very much like to learn how to do the same thing in less code.

Cheers and thanks in advance,
Alan
You can do that in the views interface, no need for pre- or post- processing on the theme level (as your script snippet suggests). 

I assume that you are using Drupal 7.x and Views 7.x-3.x. 

Go to the UI for the view you want to change:

http://example.com/admin/structure/views/view/yourviewname/edit
or Home » Administration » Structure » Views » Yourview


Make sure you are on the Display that you want to change (towards the top: Display has tabs "Page", "Add" and maybe others like "Block" or similar)

Under "Format", it shows "Format" and "Show". "Show" needs to be set to "Fields". 

The click on the field with your url, like:

 Content: URL (URL) 


A popup window will open with:

 Configure field: Content: URL


Click on "Rewrite Results" - a number of options open, check:

 Rewrite the output of this field 


A couple of additional fields now open up. 

Click on "Replacement patterns" and identify your url field, for example:

[field_url]


Now, enter the text you want to display into the "TEXT" field (can be html tags like an image tag):

An image tag
Some text


Check "Output this field as a link", and enter the replacement pattern into the "Link path " field [field_url]. 

If you want to use another field from your content type to show instead of something generic, that field needs to be on the "Fields" list BEFORE the field_url field, but can be marked as "invisible" if you don't want to display it otherwise.