I want to create a simple field that displays the current URL as a link.
Could you please tell me how to do this?

Thank you!


jvieille’s picture

Status: Active » Closed (fixed)

Not a stupid question. Actually, you better know nothing about PHP and Views customfield to make this one working.
It is a Swiss Army knife, yes, but you have to take the blade in hand and cut with the handle.
This is how you can create a url with this field:

In the Computed code area:

// Create variable for data you want to get from the node's other field : you won't get anything if you try to insert them directly
$field_a= $node->field_a[0]['value'];
$field_b= $node->field_b[0]['value'];

$node_field[0]['value'] =
// create your url at will without "http://"
// they will include free text as well as values from the node
'some text'
.$node->nid // YES, this one will work!!!
."some other text"
// and so on: 

In the display code area
$display = l('www.see.asso.fr/A','http://'.$node_field_item['value']);
In the field display setting, keep "Raw text"

I am on D6, but this might apply to D7 as well