1

Hello this is my file views-view-field--sitemap--views-data-export--field-image.tpl.php :

<?php

$fields["field_image"]->content = '<image:loc>' . $field->original_value . '</image:loc>' . '<image:title>' . $row->field_field_image[0]['rendered']['#item']["alt"] . '</image:title>';

echo $fields["field_image"]->content;

When I check the box to hide empty if the image field, the empty fields are hidden in the preview of view but not out. How to hide empty fields when the view is displayed? I think there is a line to add in the template file.

0
<?php

if (!empty($field->original_value)) {

  $fields["field_image"]->content = '<image:loc>' . $field->original_value . '</image:loc>' . '<image:title>' . $row->field_field_image[0]['rendered']['#item']["alt"] . '</image:title>';

  echo $fields["field_image"]->content;

}
  • thank you it works. I've updated the question because I have a problem with title – user54067 May 28 '16 at 9:49
  • 1
    @Mathieu you're not allowed to ask 2 questions in 1 question. Please create a new question regarding your 2nd question, thx. – No Sssweat May 28 '16 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy