I'm using the Message module to notify users when someone reacted on their nodes. I'm now trying to theme the messages, which are displayed in a view, called 'Message'.
I'd like to link a message to the content that's commented on. In other words: when a user clicks a message, he/she should be linked to the corresponding node's page. I don't simply want the message text to be a link, but the whole message (i.e. also including the other fields) should function as some kind of 'button'.
I think the easiest way to do this is to create a views-view-unformatted--message.tpl.php
file and use
<?php foreach ($rows as $id => $row): ?>
<div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"'; } ?>>
<a href="<?php print url('$url'); ?>">
<?php print $row; ?>
</a>
</div>
<?php endforeach; ?>
The problem is that I don't know how to define $url
. I can store the needed nid
in the message and add it hidden to the view, but I can't find a way to grab that information.
How can I do that?