If found this, but I can't manage to apply it to my case. Here goes. (I'm new to PHP coding and Drupal.)
I want to add a HTML link into each row of my unformatted views template. For each row I want the link for the relevant piece of content.
I used the devel dpm to reveal the variables in the unformatted.tpl.php. But I can't find a variable for the link field. (I've added the Content: Link field in views and it's hidden.)
My understanding at the moment is I'll need to set the variable in the relevant preprocess function, which might look like this:
function mytheme_preprocess_views_view_unformatted(&$variables) {
$link = Location of link field variable
}
And then use it in the views template:
<?php if (!empty($title)): ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
<div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"'; } ?>>
<?php print $row; ?>
<?php print $link; ?>
</div>
<?php endforeach; ?>
But I can't find the link information and I can't find similar examples so I've probably gone badly wrong. How would I do that and is my basic understanding ok?