tags:

views:

62

answers:

1

I have a view which lists some nodes and I want a custom output for the title of the node. Im using customfield which allows me to write PHP code but I cant find how to output the link to the node? It doesnt appear in the $data object. I can add the field, but still cant use it in the customfield code

+1  A: 

Rather than using Views Custom Field to load PHP into the database, consider modifying the views template for the title field. If you go to Theme Information, it'll give you the file hints for the field. Create the file in your theme, and modify the title that way.

This has the benefit of separating code from content, and if you do it this way, you can add the Note: Link field, exclude it from the display, and use it in the Title template you created.

Check out Group 42's Guide to Theming for more information.

Mark Trapp
Ive done as you suggested and Ive been able to create theme override the title field, but even after outputting all the variables I still cant seem to access the link or path variables.I got nid, node_title, node_body etc Any ideas? Ive added the fields in the view
Tim
I forgot Node Link isn't exactly extensible. Instead, use $path = drupal_get_path_alias('node/' . $row->nid); That'll return the path of the node. From there, use l($computed_title, $path) to generate the new title with link to the node.
Mark Trapp