I am trying to figure out if it is possible to print the content link of a field in the Views' template.

I would like to link an article title to its node, something like the following code:

print '<a href="' . $node_url . '">' . $article['und']['0']['value'] . '</a>'

This is a dumbed down version of my code in the view-view-field--field-article-title.tpl.php

$article = $row->_field_data['nid']['entity']->field_article_title;
$subtitle = $row->_field_data['nid']['entity']->field_article_subtitle;

if (isset($subtitle['und']['0']['value'])) {
  print $article['und']['0']['value'] . ': ' . $subtitle['und']['0']['value'] . '</p>';
else {   
  print $article['und']['0']['value'];

Can anyone point me in the right direction? I've tried printing out the available fields, but for some reason I cannot print the fields in the view.

1 Answer 1


I'm not an expert and this may not be the absolute best way, but it works for me in D7 view-view-field templates.

Include something like this in your template file

<a href="<?php print base_path().drupal_get_path_alias("node/{$row->nid}") ?>">...</a>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.