Fix for if image is there show it but if video is there, hide the image

  1. <div class="art-Post">
  2.     <div class="art-Post-body">
  3. <div class="art-Post-inner">
  4. <h2 class="art-PostHeader"> <?php echo art_node_title_output($title, $node_url, $page); ?>
  5. </h2>
  6. <div><?php print $date ?></div>
  7. <div class="art-PostContent">
  8.  
  9. <div class="media-block">
  10.         <div class="media-block-header"></div>
  11.                 <div class="media-block-body">
  12.                         <div class="field field-type-filefield field-field-hero-image">
  13.                         <div class="field-items">
  14.                         <div class="field-item"><?php print $node->field_hero_image[0]['view'] ?></div>
  15.                                 <div class="image-description"><?php print $node->field_hero_image[0]['data']['description'] ?></div>
  16.                         </div>
  17.                         </div>
  18.                          
  19.   <div class="field field-type-filefield field-field-hero-video">                      
  20.  <?php $video = $node->field_hero_video[0]['view']; ?>
  21.  <?php if($video) {
  22.         $output = '<h3 class="field-label">Watch the video</h3>';
  23.         $output .= '<div class="field-items">';
  24.         $output .= '<div class="field-item" >' . $node->field_hero_video[0]['view']  . '</div>';
  25.         $output .= '</div>';
  26.         print $output;
  27.  } ?>                  
  28.  </div>
  29.  
  30.  
  31. <div class="field field-type-filefield field-field-hero-audio">                        
  32.         <?php $audio = $node->field_hero_audio[0]['view']; ?>
  33.         <?php if($audio) {
  34.                 $output = '<h3 class="field-label">Hear the story</h3>';
  35.                 $output .= '<div class="field-items">';
  36.                 $output .= '<div class="field-item" >' . $node->field_hero_audio[0]['view']  . '</div>';
  37.                 $output .= '</div>';
  38.         print $output;
  39.         } ?>                   
  40.  </div>
  41.  
  42.                 </div>
  43.         <div class="media-block-footer"></div>
  44. </div>
  45.  
  46. <div class="field field-type-text field-field-hero-description">
  47. <div class="field-items">
  48. <div class="field-item"><?php print $node->field_hero_description[0]['view'] ?></div>
  49. </div>
  50. </div>
  51.  
  52. <div class="become-button">
  53.   <div align="center"><a href="http://everydayhero.org/family-needs"><img src="/sites/all/themes/everydayhero/images/become-a-hero-button.png" width="312" height="36" /></a></div>
  54. </div>
  55.  
  56. </div>
  57. </div>
  58. </div>
  59. </div>

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.