Hi there,

I am looking to rewrite the link Views provides from a node title to the URL of another node which is referenced in a nodereference field.

I have set up a Relationship to the other node, and included the (Node) Node:Link (via reference) and the Node:Title. If I attempt to use the provided [view_node] token as the target for the link, I get the text of the (Node) Node:Link as the target, and not the node ID as I would assume. From this and #292795: How to link node reference field to current node, I am guessing that I will need to make this change in the code, rather than being able to achieve this in the UI.

I have looked at overriding views-view-field.tpl.php and also started looking at how I might be able to override views_handler_field_url class, but I have hit a brick wall in regards to how to go about this as my PHP skills are not the best.

If you could point me in the right direction (e.g. where the $output variable is generated for views-view-field.tpl.php and how to override), or explain where I have missed something obvious it would be greatly appreciated.

Also, thanks for all the time that you invest into developing Views. I know most sites would be lost without it, and I am sure that most of the time it is a thankless job.

Soli Deo gloria

Jerome

CommentFileSizeAuthor
#3 screen capture 2010-11-11-12-33-42.gif56.16 KBrayvan

Comments

dawehner’s picture

Status: Active » Fixed

As far as i understand the problem you could solve this by adding a relationship to the nodereference. After this you can add the node: title field and select the nodereference-relationship

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rayvan’s picture

Status: Closed (fixed) » Active
StatusFileSize
new56.16 KB

I think what he is trying to elaborate is that the node reference field has no option for straight URL source...There are only options for Title (link), Title (no link), etc.

I've attached an example screenshot of this in a JSON page display.

rayvan’s picture

Version: 6.x-2.6 » 6.x-3.x-dev
rayvan’s picture

Status: Active » Closed (works as designed)

After discussing with dereine, this issue should be patched within CCK which allows to return of the nid for the field.

A work around within Views may be to write a custom formatter.