You are here

function ad_image_display_ad in Advertisement 5

Same name and namespace in other branches
  1. 5.2 image/ad_image.module \ad_image_display_ad()
  2. 6.3 image/ad_image.module \ad_image_display_ad()
  3. 6 image/ad_image.module \ad_image_display_ad()
  4. 6.2 image/ad_image.module \ad_image_display_ad()
  5. 7 image/ad_image.module \ad_image_display_ad()

Function used to display the selected ad.

1 call to ad_image_display_ad()
ad_image_node_view in image/ad_image.module

File

image/ad_image.module, line 14
Enhances the ad module to support banner ads.

Code

function ad_image_display_ad($ad) {

  // Strip module path from image path if serving images from adserve.php.
  $image_path = preg_replace('&' . drupal_get_path('module', 'ad') . '/&', '', file_create_url($ad->filepath));
  if ($ad->url) {
    $ad_image = "<div class=\"image-advertisement\" id=\"ad-{$ad->aid}\"><a href=\"{$ad->redirect}/@HOSTID___\" title=\"" . check_plain($ad->tooltip) . '"' . ad_link_attributes() . "><img src=\"{$image_path}\" width=\"{$ad->width}\" height=\"{$ad->height}\" alt=\"" . check_plain($ad->tooltip) . "\" /></a></div>";
  }
  else {
    $ad_image = "<div class=\"image-advertisement\" id=\"ad-{$ad->aid}\"><img src=\"{$image_path}\" width=\"{$ad->width}\" height=\"{$ad->height}\" alt=\"" . check_plain($ad->tooltip) . "\" /></div>";
  }
  return $ad_image;
}