I've been working to have a simple php conditional set up in the tpl files for a view. But the automatic loop Drupal does to this file does has been driving me nuts.
My goal is to have a title field become a link only if someone in the CMS says it needs to be linked, say through another field (checkbox).
I'm currently working in the views-view-fields-- filed for my view.
My two fields: my_checkbox (bool) and my_title (string)
$var = $row->field_field_my_checkbox['rendered']['#markup']; foreach($fields as $id => $field): if ($var = 0): print $fields['field_my_title']->$content; elseif ($var = 1): print "<a href>" . $fields['field_my_title']->$content . "</a>"; endif; endforeach;
It is good idea to try what I'm doing in this location in the view tpl files? Should I be focusing in the views-view-field-- tpl instead? Which I'm unsure how you could pull another fields output here.
I'd like to stick to coding this and not do this in the CMS for easy re-usability. Thanks in advance.