I have a view that pulls in the titles from 3 different content types. One of these content types has a title that should link to an external website, the other 2 types have titles that link to nodes within the Drupal site. Is there a way I can set the Title field to handle links differently depending on what content type the title is from?
Answered thanks to Vlad below!! :)
This is the working code we are using in the views-view-fields--news--block.tpl.php template..
<?php if ($fields['type']->content == 'Event'): ?>
<a href="<?php print $fields['path']->content; ?>"><?php print $fields['title']->content; ?></a>
<?php endif; ?>
<?php if ($fields['type']->content == 'PATF News'): ?>
<a href="<?php print $fields['path']->content; ?>"><?php print $fields['title']->content; ?></a>
<?php endif; ?>
<?php if ($fields['type']->content == 'News Link'): ?>
//This link goes to _blank
<a href="<?php print $fields['field_link']->content; ?>" target="_blank"><?php print $fields['title']->content; ?></a>
<?php endif; ?>