I have a view which has 2 fields:
[field_services_color]
& [field_services_cover]
These output fine but I need to override output with a template override.
I have this override: views-view-fields--services.tpl.php
Which has this code:
<?php foreach ($fields as $id => $field): ?>
<?php if (!empty($field->separator)): ?>
<?php print $field->separator; ?>
<?php endif; ?>
<?php print $field->wrapper_prefix; ?>
<?php print $field->label_html; ?>
<?php print $field->content; ?>
<?php print $field->wrapper_suffix; ?>
<?php endforeach; ?>
Which outputs this:
<div>
<div>COLOR</div>
</div>
<div>
<div>COVER</div>
</div>
But what I need to to do it this:
<div>
<div style="background-color:COLOR;">COVER</div>
</div>
I have looked for hours on Google for a solution but can't find any. Can this be done?
I did try doing this within views with rewrite output which seems like the simplest way but for some reason drupal strips the style attribute.
Any help with this will be very much appreciated.
C